Hello @fabien,
I apologize for not replaying in a short time.
If I understand correctly, line 76 only affects the name of the package (escaping the "+" sign), but not the "+" or "." characters in the package's version string:Following your insights, the original getbuildlog script fails because of the package's version argument (the "." and "+" are not escaped, therefore in the script's regex the first is interpreted as a metacharacter, the second as a "quantifier", both not as character); i.e. the following commands fail:Otherwise, the following command succeeds because in the regular expression "6.1.67\+1" the character "." is interpreted as metacharacter (that matches every other character; note: possible side effects), but "\+" as a character:Therefore, the complete command working command with the original script should be:So I thought another possible change to the original script might be (full script attached):This way the script works also without quoting or escaping "." and "+" characters; i.e.:Therefore command format for version argument could be compatible with the commands cited in the footer of Debian buildd page [1], but the manual page of the command should be modified.
I cannot see now if there are other side effects.
What do you think about it ?
-----
[1] buildd page
I apologize for not replaying in a short time.
Thank you so much for your insights.What I think is a bug is on line 76:"." must also be protected in package names.Code:
ESCAPED_PACKAGE=$(echo "$PACKAGE" | sed -e 's/\+/\\\+/g')
Since it's a shell script, it's easy to have a modified version in /usr/local/bin/.
I can propose "protected-patterns-getbuildlog" which keeps the default behaviour by default but automatically protects version patterns when using the -p switch.
[..]Code:
$> diff /usr/bin/getbuildlog /usr/local/bin/pp-getbuildlog 44a45,47> # Same as above but automatically protect version:> $PROGNAME -p hello 2.2-1 amd64> 59a63> This version 2024 of1_À_disroot_POINT_org GPLv3+62a67,69> ### -p automatically protects versions (treated as patterns by default)> [ "$1" = "-p" ] && { shift; PROTECTEDPTRN="true"; } || PROTECTEDPTRN="false"> 76c83,84< ESCAPED_PACKAGE=$(echo "$PACKAGE" | sed -e 's/\+/\\\+/g')---> ### protect + AND .> ESCAPED_PACKAGE=$(echo "$PACKAGE" | sed -e 's/\.\|\+/\\&/g')84a93,94> elif "$PROTECTEDPTRN" && [ "$VERSION" != "[:~+.[:alnum:]-]+" ]; then> VERSION=$(echo "$VERSION" | sed -e 's/\.\|\+/\\&/g')
If I understand correctly, line 76 only affects the name of the package (escaping the "+" sign), but not the "+" or "." characters in the package's version string:
Code:
ESCAPED_PACKAGE=$(echo "$PACKAGE" | sed -e 's/\+/\\\+/g')Code:
$ getbuildlog linux-signed-amd64 6.1.67+1$ getbuildlog linux-signed-amd64 "6.1.67+1" Code:
$ getbuildlog linux-signed-amd64 "6.1.67\+1"Code:
$ getbuildlog linux-signed-amd64 "6\.1\.67\+1"Code:
$ diff -u /bin/getbuildlog my_getbuildlog.sh--- /bin/getbuildlog 2023-10-20 18:54:42.000000000 +0200+++ my_getbuildlog.sh 2024-05-01 00:53:21.419765425 +0200@@ -82,8 +82,11 @@ elif [ "$VERSION" = "last-all" ]; then GET_LAST_VERSION=all VERSION=[:~+.[:alnum:]-]++else+ VERSION=$(echo "$VERSION" | sed 's/\.\|\+/\\&/g') fi PATTERN="fetch\.(cgi|php)\?pkg=$ESCAPED_PACKAGE&arch=$ARCH&ver=$VERSION&\ stamp=[[:digit:]]+"Code:
$ bash ./my_getbuildlog.sh linux-signed-amd64 6.1.67+1I cannot see now if there are other side effects.
What do you think about it ?
-----
[1] buildd page
Statistics: Posted by Aki — 2024-04-30 23:23