FossaPup64 pkg uninstall stops working if too many packages are installed
I'm on fossapup64 and pkg says its verison 1.9.23
anyway in the uninstall function there is this, at line 5906 on my machine
Code: Select all
# remove $PKGNAME from user-installed-packages
NEWUSERPKGS="$(grep -v "^${PKGNAME}" ${REPO_DIR}/user-installed-packages)"
[ "$NEWUSERPKGS" != "" ] && echo "$NEWUSERPKGS" > ${REPO_DIR}/user-installed-packages
this puts all of user-installed-packages into a variable. this is a problem because the script uses `set -a` (at line 310 on my machine). this makes it so all variables are automatically exported. when NEWUSERPKGS gets too big, it can make the exported environment variables exceed the linux kernel argument size limit, which is calculated as size of arguments + size of environment variables. then no other commands can run from the script so it breaks.
i fixed this on my computer by changing it to this
Code: Select all
# remove $PKGNAME from user-installed-packages
NEWUSERPKGS="$(grep -v "^${PKGNAME}" ${REPO_DIR}/user-installed-packages)"
export -n NEWUSERPKGS
[ "$NEWUSERPKGS" != "" ] && echo "$NEWUSERPKGS" > ${REPO_DIR}/user-installed-packages
the `export -n` removes NEWUSERPKGS from the exports list. but maybe there is a better way.