Bug#1043465: reportbug: apt install produces errors when run from a non-existing directory

2024-03-14 Thread Wesley Schwengle
Control: reassign 1.21.22 debconf

On Fri, Aug 11, 2023 at 04:07:11PM +, t3atwv+9rzw960a1ydj0@cs.email wrote:
> Dear Maintainer,
> 
> It doesn't matter which package you try to install, I'm using 'hello' as an 
> example of a very simple package with no dependencies.
> 
> If you try to run an `apt install` command while you are in a directory that 
> has been deleted, you will get error messages.
> 
> Example command:
> $ mkdir /tmp/hello; cd /tmp/hello; rmdir /tmp/hello; sudo apt install hello
> 
> You get an output that includes these lines:
> sh: 0: getcwd() failed: No such file or directory
> sh: 0: getcwd() failed: No such file or directory
> sh: 0: getcwd() failed: No such file or directory
> sh: 0: getcwd() failed: No such file or directory
> sh: 0: getcwd() failed: No such file or directory
> cannot fetch initial working directory: No such file or directory at 
> /usr/sbin/dpkg-preconfigure line 73.
> cannot fetch initial working directory: No such file or directory at 
> /usr/sbin/dpkg-preconfigure line 159.
> 
> The package installs successfully, but the messages are still not something 
> the user should see.

This is actually a debconf bug as the warnings/errors are emitted by
/usr/sbin/dpkg-preconfigure.

I don't fully agree that this is a bug but I'll let the debconf folks decide
over that. I think it is quite useful to have this information in case things
would go wrong because being in a non-existent directory might not be a normal
situation.

The reproduction path can be slightly adjusted to:
mkdir /tmp/hello; cd /tmp/hello; rmdir /tmp/hello; sudo 
/usr/sbin/dpkg-preconfigure hello

I can verify that the behavior is present on bookworm and unstable.

Cheers,
Wesley



Bug#1043465: reportbug: apt install produces errors when run from a non-existing directory

2023-08-11 Thread t3atwv+9rzw960a1ydj0
Package: apt
Version: 2.6.1
Severity: normal

Dear Maintainer,

It doesn't matter which package you try to install, I'm using 'hello' as an 
example of a very simple package with no dependencies.

If you try to run an `apt install` command while you are in a directory that 
has been deleted, you will get error messages.

Example command:
$ mkdir /tmp/hello; cd /tmp/hello; rmdir /tmp/hello; sudo apt install hello

You get an output that includes these lines:
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
cannot fetch initial working directory: No such file or directory at 
/usr/sbin/dpkg-preconfigure line 73.
cannot fetch initial working directory: No such file or directory at 
/usr/sbin/dpkg-preconfigure line 159.

The package installs successfully, but the messages are still not something the 
user should see.

I discovered this when I wanted to install some package, and I grabbed the 
nearest terminal window I had open without realizing the current working 
directory in that terminal has already been deleted from a different terminal 
window.


-- System Information:
Debian Release: 12.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-10-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages apt depends on:
ii  adduser 3.134
ii  debian-archive-keyring  2023.3
ii  gpgv2.2.40-1.1
ii  libapt-pkg6.0   2.6.1
ii  libc6   2.36-9+deb12u1
ii  libgcc-s1   12.2.0-14
ii  libgnutls30 3.7.9-2
ii  libseccomp2 2.5.4-1+b3
ii  libstdc++6  12.2.0-14
ii  libsystemd0 252.12-1~deb12u1

Versions of packages apt recommends:
ii  ca-certificates  20230311

Versions of packages apt suggests:
pn  apt-doc  
pn  aptitude | synaptic | wajig  
ii  dpkg-dev 1.21.22
ii  gnupg2.2.40-1.1
pn  powermgmt-base   

-- no debconf information