Open wileyhy opened 1 year ago
Hello, I think the mentioned issue is not coming from the dnf
component, but rather from librepo
.
There is the TMPDIR
constant in dnf
, but given message Cannot create temporary file - mkstemp '/sound/librepo-tmp-EZSao0': No such file or directory
is coming from librepo
when the file is being downloaded into temporary location with the lr_gettmpfile
function here. It doesn't use the TMPDIR
constant from DNF, but the directory is taken from global environment variable when using GLib call g_get_tmp_dir
, see here.
So the handling of the situation is done in GLib, the only thing of improving the situation from the user POV I can think of now is like checking the TMPDIR
by ourselves in librepo
and reseting it in case of non-existence, but I don't feel it is a good way as the GLib implementation could change...
Hey, Well, I'm still a bit of a newbie with such questions, so... To me it seems like, since '/tmp' is hard-coded a value of last resort, that providing the name of some known-as-existing directory is probably intended, because /tmp is so conventionally ubiquitous (right? ...it seems to be...). However, it is a temporary directory we're talking about here, so it also seems like there should be at least some expectation that the value of TMPDIR might have already bit the bucket by the time g_get_tmp_dir looks for a parameter value. idk
dnf/dnf/conf/config.py: if TMPDIR is set to a non-existent dir, upgrades will fail.
in addition to testing whether TMPDIR is set, config.py should also check that the directory TMPDIR points to actually exists, in my opinion.
export TMPDIR=/sound
dnf -y install ncdu
dnf -y upgrade
mapfile -t rpm_rpms < <(rpm -qa | grep -e dnf -e yum -e rpm )
: > ~/files
for r in "${rpm_rpms[@]}"; do unset foo; mapfile -t foo < <(rpm -ql "$r"); file -pk "${foo[@]}" >> ~/files; done
mapfile -t gfs < <( awk -F':' ' { print $1 }' ~/files )
grep -- mkstemp "${gfs[@]}" 2> /dev/null
git clone https://github.com/rpm-software-management/dnf
cd ./dnf; ls
grep -rn mkstemp .
find / -type f -path '*/dnf/conf/*' -name '*config.py*' 2> /dev/null
unset TMPDIR r rpms_rpms gfs
cd ..; rm -fr ./dnf