Bug#939997: dpkg: Please expose other data to post-invoke and pre-invoke commands
Hello again, Guillem! On Wed, Sep 11, 2019 at 10:24 PM Matt Zagrabelny wrote: > > One could expose any/all of the following (if available): > > DPKG_HOOK_PACKAGE_FILENAME=/path/to/some.deb > DPKG_HOOK_PACKAGE_NAME=foo > DPKG_HOOK_PACKAGE_FD=12 > > >> Also these would need to get multiple entries, and >> for filenames that might include spaces, so they'd need to be escaped >> somehow. > > > Thinking more about this, we could use a NUL byte '\0' to separate multiple entries. This would mimic /proc/PID/cmdline. I feel like that is the cleanest implementation. No escaping required. Any further thoughts about this bug report? Would you accept a patch? Thanks, -m
Bug#939997: dpkg: Please expose other data to post-invoke and pre-invoke commands
Hey Guillem! Thanks for the reply. On Wed, Sep 11, 2019 at 9:14 PM Guillem Jover wrote: > Hi! > > On Tue, 2019-09-10 at 16:39:22 -0500, Matt Zagrabelny wrote: > > Package: dpkg > > Version: 1.19.7 > > Severity: wishlist > > > I would like to access other meta data (besides DPKG_HOOK_ACTION) when > > running various pre/post-invoke commands. > > > > Would you consider exposing: > > > > DPKG_HOOK_PACKAGE_NAME > > > > That contains the package name? > > This would only be available for actions that operate on package names, > Sure. That is okay. > or actions that operate on package filenames would get filenames and > not package names. Sure. The filename contains a package name. One could expose any/all of the following (if available): DPKG_HOOK_PACKAGE_FILENAME=/path/to/some.deb DPKG_HOOK_PACKAGE_NAME=foo DPKG_HOOK_PACKAGE_FD=12 > Also these would need to get multiple entries, and > for filenames that might include spaces, so they'd need to be escaped > somehow. Sure. Space separation for multiple package names, filenames, and fd's seems sensible with escaped spaces for filenames. > Or perhaps passed via a file descriptor like apt is doing. > Okay. > I'm curious what would you like to use something like this for? > I'd like to keep track of package upgrades (version, package name, timestamp, etc.) in a relational database for audit purposes. I know I could scrape dpkg.log, but thought it would be more elegant to use a post-invoke hook. Thanks for the dialog! -m
Bug#939997: dpkg: Please expose other data to post-invoke and pre-invoke commands
Hi! On Tue, 2019-09-10 at 16:39:22 -0500, Matt Zagrabelny wrote: > Package: dpkg > Version: 1.19.7 > Severity: wishlist > I would like to access other meta data (besides DPKG_HOOK_ACTION) when > running various pre/post-invoke commands. > > Would you consider exposing: > > DPKG_HOOK_PACKAGE_NAME > > That contains the package name? This would only be available for actions that operate on package names, or actions that operate on package filenames would get filenames and not package names. Also these would need to get multiple entries, and for filenames that might include spaces, so they'd need to be escaped somehow. Or perhaps passed via a file descriptor like apt is doing. I'm curious what would you like to use something like this for? Thanks, Guillem
Bug#939997: dpkg: Please expose other data to post-invoke and pre-invoke commands
Package: dpkg Version: 1.19.7 Severity: wishlist Greetings, I would like to access other meta data (besides DPKG_HOOK_ACTION) when running various pre/post-invoke commands. Would you consider exposing: DPKG_HOOK_PACKAGE_NAME That contains the package name? Thank you! -m -- Package-specific info: -- System Information: Debian Release: bullseye/sid APT prefers oldoldstable APT policy: (500, 'oldoldstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.2.0-2-amd64 (SMP w/8 CPU cores) Kernel taint flags: TAINT_WARN, TAINT_FIRMWARE_WORKAROUND Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages dpkg depends on: ii libbz2-1.0 1.0.8-2 ii libc62.29-1 ii liblzma5 5.2.4-1+b1 ii libselinux1 2.9-2+b2 ii tar 1.30+dfsg-6+b1 ii zlib1g 1:1.2.11.dfsg-1+b1 dpkg recommends no packages. Versions of packages dpkg suggests: ii apt1.8.3 pn debsig-verify -- no debconf information