archlinux-downgrade / downgrade

Downgrade packages in Arch Linux
GNU General Public License v2.0
570 stars 24 forks source link

Packages with a slash in the name cannot be downgraded #184

Closed nailuj29 closed 2 years ago

nailuj29 commented 2 years ago

:bug: Bug Report

Checklist

Environment

Description

Package downgrade fails when package name has a slash

Steps to Reproduce

  1. First Step downgrade 'extra/boost-libs'

Expected behavior

The package is downgraded

Actual behavior

sed: -e expression #1, char 40: Unmatched ( or \(
No results found
Unable to downgrade extra/boost-libs

Command trace

atreyasha commented 2 years ago

Hi @nailuj29. In regards to downgrading boost-libs, just downgrading with the package name should do the trick. In other words, specifying the repository extra here is unnecessary:

# downgrade boost-libs

Also, package names containing slashes are not permitted as per the Arch package guidelines, so accounting for slashes in package names is probably not a concern.

@pbrisbin on the other hand, I think providing a slash (or any other disallowed character) in the package name should ideally lead to a standard error message and not the sed error message sed: -e expression .... I think this might have to do with these special characters not being escaped properly before the regular expression. Do you think it makes sense to escape the package entries beforehand with something like printf "%q"?

Edit: printf won't work here. We would need to manually escape the special character that we used in our sed replace patterns, see here: https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern

pbrisbin commented 2 years ago

I think providing a slash (or any other disallowed character) in the package name should ideally lead to a standard error message and not...

Agreed with the principle. In this case, it could be better to respond to the failure instead of aiming to prevent it, something like:

if ! { whatever contains the sed }; then
  echo "{better error message}. $input might be invalid?"
  exit 1
fi

Or, if / is by far the most common mistake, and it's a problem because we do s/.../, we could do anything else, such as s|...| or s%...%.

nailuj29 commented 2 years ago

@atreyasha, When I run downgrade boost-libs it outputs this and fails.


Downgrading from A.L.A. is disabled on the stable branch. To override this behavior, set DOWNGRADE_FROM_ALA to 1 .
See https://wiki.manjaro.org/index.php/Downgrading_packages  for more details.

No results found
Unable to downgrade boost-libs
pbrisbin commented 2 years ago

That's something Manjaro does. I suggest asking in their forums.

On Sun, Feb 27, 2022, 16:46 nailuj29 @.***> wrote:

@atreyasha https://github.com/atreyasha When I run downgrade boost-libs it outputs this and fails.

Downgrading from A.L.A. is disabled on the stable branch. To override this behavior, set DOWNGRADE_FROM_ALA to 1 . See https://wiki.manjaro.org/index.php/Downgrading_packages for more details.

No results found Unable to downgrade boost-libs

— Reply to this email directly, view it on GitHub https://github.com/pbrisbin/downgrade/issues/184#issuecomment-1053693021, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMM7FFMMDM7FVAHJIGSKLU5KLSVANCNFSM5PL7XVMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>