Closed Vekhir closed 1 month ago
Silently discarding arguments as it does now is clearly wrong, but I'm not sure exactly how --
should work for pactrans
. The way that --install
, --remove
, --spec
, and --file
work makes it a little awkward and I think the official way to pass arbitrary package names will be via file descriptor when I finally finish that. Also, --xy
is not a valid package name; makepkg
will not build such a package and libalpm
will reject it as well.
Fixed.
When encountering
--
on the commandline,getopt
stops parsing the arguments. It is customary to then interpret all following arguments as positional (i.e. the targets forpactrans
).This allows to define targets without having to worry about potential issues with
--xy
in the names. It shouldn't happen, but it's another layer of security, especially for script environments.Examples:
pactrans --install -- pacutils
works likepactrans --install pacutils
pactrans --install -- --noconfirm pacutils
failspactrans --install --noconfirm -- pacutils
works likepactrans --install --noconfirm pacutils
At the moment,
pactrans
just fails witherror: no targets provided.