[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#818687: RFS: btrfs-progs/4.4.1-1.1 [NMU]



On 20 April 2016 at 18:33, James Cowgill <jcowgill@debian.org> wrote:
>> "if [ -x /usr/sbin/update-initramfs ] && [ -e /etc/initramfs-tools/initramfs.conf ]"
>
> I don't think there's anything particularly wrong with that line.
>
> The previous attempts at fixing this (using 'hash' and 'command -v')
> are both bashisms so they shouldn't be used.
>
> If you really want to fix the lintian warning, using 'which' is
> probably the best idea here since it's an essential executable, not a
> shell builtin.
>
> if which update-initramfs > /dev/null 2>&1 && [ -e /etc/initramfs-tools/initramfs.conf ]

My first instinct was to use `which command`, which is what I
generally use, but because this was official Debian work I read up on
which vs hash vs command -v.  What I found was that `which` has
undefined exit values from xNIX to yNIX, and is apparently considered
bad style by some people.  Hash was the oldest posix-correct way to do
it, using a shell internal function.  In this case, I think it broke
on piuparts because piuparts used bash; so I think this was an dashism
rather than a bashism ;-)

That's why I eventually settled on command -v, because "POSIX shells
users have command -v" (
http://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
).

> Also see:
> https://www.debian.org/doc/manuals/developers-reference/ch06.html#bpp-debian-maint-scripts
> https://lintian.debian.org/tags/command-with-path-in-maintainer-script.html

Yes, I read this for my initial upload.  When Gianfranco's requested
fixing piupart's warning I inferred that the manual was out of date
relative to the current/sid standard that piupart was checking for.

On 20 April 2016 at 17:24, Gianfranco Costamagna
<locutusofborg@debian.org> wrote:
> Hi,
> you missed the change on postrm, and BTW I think this is out of the NMU scope, can we please leave the change
> out?
> I'm not too confident about it, I would like to just rename the package and let xnox give his opinion on
> the postinst and postrm scripts.

Thank you, I would be happy to!  Honestly, changing the postinst and
postrm scripts make me feel like I was walking the "package hijack"
line...uncomfortable.  Needless to say, what I've learned is that I
definitely need to get sbuild setup with automatic lintian and
piuparts checks to get it right on the first upload.  All apprentices
are started with repetitive tasks until they master precision while
working quickly, and sometimes the mentor throws in challenges 'just
to test the apprentice's problem solving skills.  I figured this was
something like that.  I've reuploaded to the same location, with a
postrm fix.  Here is the patch to restore "if [ -x
/usr/sbin/update-initramfs ]" if you prefer the xnox's original:

diff -ur ./debian/btrfs-progs.postinst
../btrfs-progs-4.4.1-static_path/debian/btrfs-progs.postinst
--- ./debian/btrfs-progs.postinst       2016-04-15 15:48:08.000000000 -0400
+++ ../btrfs-progs-4.4.1-static_path/debian/btrfs-progs.postinst
 2016-04-20 19:21:38.921718780 -0400
@@ -4,7 +4,7 @@

 case "${1}" in
        configure)
-               if [ -x `command -v update-initramfs` ] && [ -e
/etc/initramfs-tools/initramfs.conf ]
+               if [ -x /usr/sbin/update-initramfs ] && [ -e
/etc/initramfs-tools/initramfs.conf ]
                then
                        update-initramfs -u
                fi
diff -ur ./debian/btrfs-progs.postrm
../btrfs-progs-4.4.1-static_path/debian/btrfs-progs.postrm
--- ./debian/btrfs-progs.postrm 2016-04-20 19:20:06.649840857 -0400
+++ ../btrfs-progs-4.4.1-static_path/debian/btrfs-progs.postrm
2016-04-20 19:21:58.049693561 -0400
@@ -4,7 +4,7 @@

 case "${1}" in
        remove)
-               if [ -x `command -v update-initramfs` ] && [ -e
/etc/initramfs-tools/initramfs.conf ]
+               if [ -x /usr/sbin/update-initramfs ] && [ -e
/etc/initramfs-tools/initramfs.conf ]
                then
                        update-initramfs -u
                fi
diff -ur ./debian/changelog ../btrfs-progs-4.4.1-static_path/debian/changelog
--- ./debian/changelog  2016-04-20 19:18:09.337997103 -0400
+++ ../btrfs-progs-4.4.1-static_path/debian/changelog   2016-04-20
19:22:16.621669102 -0400
@@ -6,7 +6,6 @@
   * Update standards version to 3.9.7 (no changes needed).
   * debian/control: Add "Breaks" per Gianfranco Costamagna's suggestion
   * Change lintian override to reflect package rename
-  * Address lintian error "command-with-path" in postinst and postrm scripts

  -- Nicholas D Steeves <nsteeves@gmail.com>  Fri, 15 Apr 2016 15:48:37 -0400

Cheers,
Nicholas


Reply to: