Discussion:
[Slackbuilds-users] Metacharacters in package names
Chris Abela
2018-08-22 20:13:26 UTC
Permalink
Hi,

I have written a short script that lists built packages on which no
other package depends:
https://github.com/ChrisAbela/apex/blob/master/apex.sh

It assumes that the user is using sbopkg and relies on rigorously
maintained queue files.

The script wrongly lists tolua++ as an "apex package" as egrep (at line
52) interprets the "+" metacharacter. May I suggest to avoid
metacharacters in package names. In this case toluapp would have been a
better choice, as per homepage: https://github.com/LuaDist/toluapp.

Thanks to all that maintain scripts. You make Slackware a better experience.

Chris Abela

_______________________________________________
SlackBuilds-users mailing list
SlackBuilds-***@slackbuilds.org
https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
FAQ - https://slackbuilds.org/faq/
Ruben Schuller
2018-08-22 20:42:03 UTC
Permalink
Hi,

On Wed, 22 Aug 2018 22:13:26 +0200
Post by Chris Abela
The script wrongly lists tolua++ as an "apex package" as egrep (at
line 52) interprets the "+" metacharacter. May I suggest to avoid
metacharacters in package names. In this case toluapp would have been
a better choice, as per homepage: https://github.com/LuaDist/toluapp.
I'd say that, even if special characters are avoided in package names,
you should sanitize/filter the inputs accordingly to where they are
used. IMHO package renaming should only be done in really pressing
cases, as there are other things which don't work without friction then
(upgrading the package for example). Furthermore, each artificial
restriction will be a requirement soon, as other things will depend on
it.

This could be a good solution for the problem in your script:
https://stackoverflow.com/a/16951928

Kind Regards
Ruben
_______________________________________________
SlackBuilds-users mailing list
SlackBuilds-***@slackbuilds.org
https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
FAQ - https://slackbuilds.org/faq/
B Watson
2018-08-22 21:38:07 UTC
Permalink
Post by Ruben Schuller
https://stackoverflow.com/a/16951928
My eyes! The goggles, they do nothing!

Using grep instead of egrep would also be a solution to this issue.

grep can do everything (or maybe almost everything?) egrep does, just
needs extra \ in front of some of the metacharacters to make them meta.
_______________________________________________
SlackBuilds-users mailing list
SlackBuilds-***@slackbuilds.org
https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
FAQ - https://slackbuilds.org/faq/
Chris Abela
2018-08-23 06:33:36 UTC
Permalink
Post by B Watson
Post by Ruben Schuller
https://stackoverflow.com/a/16951928
My eyes! The goggles, they do nothing!
Using grep instead of egrep would also be a solution to this issue.
I confess that I had to look up that meme. I understand that you wanted
to express your dislike on the previous solutions kindly offered by the
previous interlocutor. I don't like it as well. My preferred solution
would be to distract the author of this application and plug out the '+'
key from his/her keyboard. Or else I can rely on the undocumented and
exclusive pkgtool feature to rename installed packages on the fly using
the mv command: mv /var/log/packages/tolua++ /var/log/packages/toluapp
(and prove once again that Slackware is unbreakable).

There are many solutions but my intention was not to request assistance
on my script. The script is just a cosmetic addition to sbopkg anyway.
My intention was to solicit your reconsideration on the inclusion of
metacharacters in package names. They are a nuisance, ugly and they
break things. Which characters are acceptable? Would you also accept
white spaces and semi-colons?

Chris Abela
Didier Spaier
2018-08-23 09:06:37 UTC
Permalink
My intention was to solicit your reconsideration on the inclusion of metacharacters in package names. They are a nuisance, ugly and they break things. Which characters are acceptable? Would you also accept white spaces and semi-colons?
Let's distinguish between '+', spaces and semi-colons

'+' is special only in extended regular expression according to POSIX and can then be escaped, cf. §9.4.3 ERE Special Characters
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04

The POSIX specification requires that sed supports the basic regular expressions but supporting the EREs is not required, cf. Regular Expressions in sed:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_02.

A BRE can always be used instead of an ERE as far as I know.

Anyway, the '+" character is used in names of packages shipped in Slackware:

didier[/var/log/packages]$ ls /var/log/packages|grep '+'
biff+comsat-0.17-x86_64-1
dvd+rw-tools-7.1-x86_64-2
gcc-g++-5.5.0-x86_64-1_slack14.2
gtk+-1.2.10-x86_64-5
gtk+2-2.24.31-x86_64-1_slack14.2
gtk+3-3.18.9-x86_64-1
libcdio-paranoia-10.2+0.93+1-x86_64-1
libsigc++-2.6.2-x86_64-1
didier[/var/log/packages]$

spaces an semi-colons instead shall be quoted if they are to represent themselves, cf. the POSIX specification, Shell Command Language §2.2 Quoting:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02

So in this case not using them in package names is wise.

All this being said I am not a SBo admin, and this is just my opinion.

Didier



_______________________________________________
SlackBuilds-users mailing list
SlackBuilds-***@slackbuilds.org
https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
FAQ - https://slac
B Watson
2018-08-23 10:34:49 UTC
Permalink
Post by Didier Spaier
biff+comsat-0.17-x86_64-1
dvd+rw-tools-7.1-x86_64-2
gcc-g++-5.5.0-x86_64-1_slack14.2
gtk+-1.2.10-x86_64-5
gtk+2-2.24.31-x86_64-1_slack14.2
gtk+3-3.18.9-x86_64-1
libcdio-paranoia-10.2+0.93+1-x86_64-1
libsigc++-2.6.2-x86_64-1
Bingo. Pat never wrote any formal package-naming spec for Slackware,
so all we have to go by is looking at the names he uses and deducing a
set of rules from them.

It means + is allowed... and I wish it weren't, 'cause package names
with + in them have caused problems for my pet project too (sbosrcarch).

It also means it's OK to randomly use names like MPlayer (capital
letters), which drives me insane (because they're effectively random. If
the caps had a meaning, like ClassName and methodName in OO languages,
I'd be less insane...)

How about UTF-8 accented/umlauted characters in package names? Slackware
doesn't ship any packages like that... so we can say "no, not allowed".
If Pat did start shipping a package with an umlaut in the name[*],
would that open the door for all of Unicode? You think + is annoying
to deal with, wait'll you have to handle emoticons, Linear-B, Klingon,
Sanskrit, cuneiform, braille (visually represented) and something like
30,000 Chinese characters...

[*] That's at least theoretically possible: "love" on SBo is actually
called "LÖVE" by its developers (that's an umlauted O, in case gmail
mangles it).

Er, and what point am I making? Not sure. How about this:

<***@monolith:/var/log/packages>$ ls | grep -v SBo | rev | cut -d-
-f4- | rev | sed 's,.,&\n,g' | sort -u | grep -v '[A-Za-z0-9]' | xargs
echo
+ - _

(That's on a full install with nothing but Slackware and SBo packages...)

So, plus, hyphen, and underscore are the only non-alphanumeric characters
Pat uses. And they're 7-bit ASCII only. Those should be our rules,
too. I'd even go so far as to say we should stick to that even if Pat
changes his rules (because Pat doesn't have to care about his package
names breaking sbopkg, sbotools, etc, and we do, or at least should).
Didier Spaier
2018-08-23 11:53:09 UTC
Permalink
Post by B Watson
So, plus, hyphen, and underscore are the only non-alphanumeric characters
Pat uses. And they're 7-bit ASCII only. Those should be our rules,
too. I'd even go so far as to say we should stick to that even if Pat
changes his rules (because Pat doesn't have to care about his package
names breaking sbopkg, sbotools, etc, and we do, or at least should)
In my opinion tools like sbotool sbopkg and such should be adapted to
handle filenames including other characters than alpha-numeric, plus,
hyphen, and underscore if they appear in Slackware package names.

I don't expect that all 137,374 characters listed in Unicode 11.O will
be used though, anyway less than half of them have an associated
glyph even among the GNU Unifont and Noto fonts ;)

But of course we'd better avoid to use those that can need to be quoted
listed in
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02

Namely:

| & ; < > ( ) $ ` \ " ' <space> <tab> <newline>

and also:

* ? [ # ˜ = %

Didier

Loading...