If the chroot is exited with nonzero status, kiss-chroot runs `die
chroot failed`. Then, die runs `exit 1` which causes the trap to
execute. However, in this scope, "$@" is "chroot failed", so the trap
evaluates $1 to be "chroot" rather than the mountpoint given to the
kiss-chroot script. Then, the trap tries to unmount "chroot/dev" etc
rather than the true mountpoint.
This patch uses double quotes rather than single when setting the trap,
so that $1 is expanded then and the mountpoint is stored for when the
trap is called.
Commit d94c811 changed `sort -u` to `uniq -u`; these are not equivalent.
`uniq -u` suppresses all duplicate lines, but `sort -u` removes all but
one. In the case of there being no command-line args, PWD is taken as
the package, and if that package is in a repo already in KISS_PATH, the
repo will be in KISS_PATH twice. This will cause the `kiss search`
command to give two entries for PWD, and `uniq -u` removes both.
Revert to `sort -u` to keep one of those entries.
If the package in PWD is not installed, there will be not entries left;
if it is installed, kiss-maintainer will try to get the history from
/var/db/kiss/installed/pkg, which is not a git repo.
Example of the incorrect behaviour:
KISS_PATH=/home/me/repo/core
PWD=/home/me/repo/core/musl
$ sh -x /usr/bin/kiss-maintainer
+ '[' ]
+ export 'KISS_PATH=/home/me/repo/core::/home/me/repo/core'
+ set -- musl
+ kiss search musl
+ uniq -u
+ read -r repo
+ read -r repo
+ cd /var/db/kiss/installed/musl
+ git log -1 version
+ m=
+ :
+ m=
+ m=
+ '[' ]
+ continue
+ read -r repo
(no output)
if a package contains a file with a quote in it's name, xargs complains
about an unmatched quote and fails, and the pipeline is aborted.
this patch escapes all non-alphanumeric characters so that xargs can
handle such filenames.
Previously, if kiss-size was ran on a package that owns a lot of
files, kiss-size would error out. This is because du wasn't
able to handle the number of files provided to it.
This patch solves this issue, by avoiding the generation of the 'files'
variable, and instead piping directly into xargs which then feeds the
files to du.
For an example package that breaks with the previous implementation,
see https://github.com/ehawkvu/kiss-tex/tree/master/texlive/texlive-fontsextra
which installs around 94,000 files.
This utility must be rewritten (with added complexity). There is
no portable way to tell tar to add a directory but not include its
contents (unless it is empty).
The simple approach of giving tar the package's manifest is not
workable without omitting directories. This causes issues when
installing an exported tarball and target directories do not exist.
The most obvious solution is to copy all of the package's files
to a temporary directory and then pass that to tar. This would
work fine but slow the process down substantially.
Another solution will be sought and if not possible the above will
be implemented instead.
Closes#254