Page MenuHome GnuPG

Warning message "DBG: locking for ... done via O_EXCL" cannot be suppressed
Closed, ResolvedPublic


# as unprivileged user, "bar"

sudo dnf -y install sshfs    # or equivalent
sudo useradd -m joe
sudo passwd joe
mkdir mnt/
sshfs joe@localhost: mnt/ -o idmap=user
export GNUPGHOME="$HOME/mnt/.gnupg"
$ gpg --list-keys
gpg: directory '/home/bar/mnt/.gnupg' created
gpg: DBG: locking for '/home/bar/mnt/.gnupg/pubring.kbx.lock' done via O_EXCL
gpg: keybox '/home/bar/mnt/.gnupg/pubring.kbx' created
gpg: DBG: locking for '/home/bar/mnt/.gnupg/pubring.kbx.lock' done via O_EXCL
gpg: DBG: locking for '/home/bar/mnt/.gnupg/trustdb.gpg.lock' done via O_EXCL
gpg: /home/bar/mnt/.gnupg/trustdb.gpg: trustdb created

$ gpg --list-keys
gpg: DBG: locking for '/home/bar/mnt/.gnupg/pubring.kbx.lock' done via O_EXCL

I've tried experimenting with --debug-level, --debug, --no-tty, --no-verbose, --quiet, etc., but this seemingly informational/debug message seems to be always printed.

ltrace doesn't really tell what logging mechanism this goes through,

[pid 24809] gpgrt_fileno(0x560a6cbb1f20, 0, 0, 0)              = 2
[pid 24809] gcry_xmalloc(20, 0, 0, 0)                          = 0x560a6cbb6210
[pid 24809] gpgrt_fopencookie(0x560a6cbb6210, 0x560a6c57547d, 0, 0) = 0x560a6cbb6460
[pid 24809] gpgrt_setvbuf(0x560a6cbb6460, 0, 1, 0)             = 0
[pid 24809] gpgrt_flockfile(0x560a6cbb6460, 0, 0, 0x560a6cbba5b0) = 0
[pid 24809] gpgrt_fputs_unlocked(0x560a6c5a1aa0, 0x560a6cbb6460, 0, 0) = 0
[pid 24809] gpgrt_fputs_unlocked(0x560a6c57bda2, 0x560a6cbb6460, 0x560a6cbb85b0, 5) = 0
[pid 24809] gpgrt_vfprintf_unlocked(0x560a6cbb6460, 0x560a6c57c080, 0x7ffd5bcbf650, 0x203a4742 <unfinished ...>
[pid 24809] write(2, "gpg: DBG: locking for '/home/bar"..., 60gpg: DBG: locking for '/home/bar/mnt/.gnupg/pubring.kbx.lock) = 60
[pid 24809] write(2, "' done via O_EXCL\n", 18' done via O_EXCL
)                = 18
[pid 24809] <... gpgrt_vfprintf_unlocked resumed> )            = 68
[pid 24809] strlen("locking for '%s' done via O_EXCL"...)      = 33

This would seem to imply that the

# define my_debug_1(a,b)    fprintf (stderr, (a), (b))

variant of my_debug_1 got used, but no - doing a backtrace, log_debug was chosen in the big #ifdef GNUPG_MAJOR_VERSION in common/dotlock.c.

#0  log_debug (fmt=0x55555563ab40 "locking for '%s' done via O_EXCL\n") at logging.c:967
#1  0x000055555560441b in dotlock_create_unix (h=0x555555669330, file_to_lock=0x555555669290 "/home/bar/mnt/.gnupg/pubring.kbx") at dotlock.c:762
#2  0x00005555555f6b9a in keybox_lock (hd=hd@entry=0x5555556692c0, yes=yes@entry=1, timeout=timeout@entry=0) at keybox-init.c:281
#3  0x00005555555864f5 in keydb_add_resource (url=<optimized out>, flags=4) at keydb.c:828
#4  0x00005555555685fe in main (argc=<optimized out>, argv=<optimized out>) at gpg.c:4055

I haven't looked deeper into why log_debug cannot be suppressed.

Debugging done on gnupg2-2.2.20-2.fc32.x86_64, but the problem is still present in gnupg2-2.2.25-2.fc34.x86_64.
Also reproduced with upstream version of gnupg-2.2.25.

Since the message seems like an implementation detail, maybe it shouldn't even be printed by default.




Related Objects

Event Timeline

Just for reference what OS and file system is this? It looks like some x32 Linux.

This is x86_64 (amd64) Fedora Linux version 32 (nothing to do with the x32 sorta-architecture).

werner claimed this task.

You are lucky. The report came just in time for the 2.2.26 released. Not mentioned over thre but anyway fixed. See T5153