[Pkg-privacy-maintainers] Bug#613678: workaround for sockets on long paths
Antoine Beaupré
anarcat at orangeseeds.org
Sun Jan 27 22:44:37 GMT 2019
After a little more testing and research, I have found a workaround for
failures to create socket paths larger than the predefined size.
It seems rather silly, but it turns out that the size is not based on
the absolute, canonical file path. This means a simple symlink in
another location works around the issue. I have unfortunately not been
able to instrument this in the test suite of the package I'm working on
right now.
But the idea is to pre-emptively start an agent for the affected process
(in my case, the test suite) under a directory with a shorter path,
symlinked to the normal GPGHOMEDIR, something like this:
TMPDIR=$(mktemp -d gpghome)
ln -s $PWD/testgpghome $TMPDIR/testgpghome
gpg-agent --homedir $TMPDIR/testgpghome --daemon ...
Because it is a symlink, it does not suffer from the permission problems
other proposed solutions have. I create a temporary directory as a
parent to work around possible issues with GPG checking the parent
directories as well.
For some reason, this fails in my test setup:
# workaround bug in gpg-agent: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206
override_dh_auto_test:
TMPDIR=`mktemp -d` && \
ln -s $(CURDIR)/testdata/gpghome $$TMPDIR/testgpghome && \
gpg-agent --homedir $$TMPDIR/testgpghome --daemon dh_auto_test && \
rm -r $$TMPDIR
The already started agent gets ignored by the test suite, I don't know
why. Instead, I am using this detection code to skip the test suite in
case of an hostile environment:
SUN_PATH_LIMIT=108
# workaround bug in gpg-agent: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206
override_dh_auto_test:
SOCKET_PATH="$${PWD}/testdata/gpghome/S.gpg-agent" ; \
if [ $${#SOCKET_PATH} -gt $(SUN_PATH_LIMIT) ]; then \
echo "W: current path too long ($${#SOCKET_PATH} > 108), skipping tests: $$SOCKET_PATH" ; \
else \
echo "I: current path not too long, running tests ($${#SOCKET_PATH}): $$SOCKET_PATH"; dh_auto_test ;\
fi
It's crap (because it just skips the tests), but at least it doesn't
crash the build. :/
A.
--
During the initial stage of the struggle, the oppressed, instead of
striving for liberation, tend themselves to become oppressors The very
structure of their thought has been conditioned by the contradictions of
the concrete, existential situation by which they were shaped. Their
ideal is to be men; but for them, to be men is to be oppressors. This is
their model of humanity.
- Paulo Freire, Pedagogy of the Oppressed
More information about the Pkg-privacy-maintainers
mailing list