Packages with a slash in the name cannot be downgraded
nailuj29 opened this issue Β· comments
π Bug Report
Checklist
- No duplicate issues/PRs
- Are you running the latest
downgrade
release from the AUR?
Environment
- System information:
Linux nailuj29 5.15.21-1-MANJARO #1 SMP PREEMPT Sun Feb 6 12:21:42 UTC 2022 x86_64 GNU/Linux
- Downgrade version:
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.
11.0.0
Description
Package downgrade fails when package name has a slash
Steps to Reproduce
- 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
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
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%...%
.
@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