Bug#923210: bash-completion: postinst and postrm generate find warnings

2019-02-27 Thread Daniel Lewart
Gabriel,

> > Both "apt install bash-completion" and "apt purge bash-completion"
> > generate the following warning:
> >   find: '/etc/bash_completion.d/': No such file or directory

> > The cause is that postinst and postrm assume that
> > /etc/bash_completion.d exists.

> Is it safe to upload such a change so close to the freeze?  I'm always
> worried about unforeseen side-effects.

The patch might be easier to understand by ignoring indentation:

diff -br a/debian/postinst b/debian/postinst
6a7
> if [ -d /etc/bash_completion.d ]; then
19a21
> fi
diff -br a/debian/postrm b/debian/postrm
7a8
> if [ -d /etc/bash_completion.d ]; then
11a13
> fi

I think it is safe, but I defer to you.

> ...
> Is this hunk needed?  The test (-d /etc/bash_completion.d/helpers) is
> not likely to produce the warnings you mentioned.

Absolutely.  The warnings come from the following line in both
post{inst,rm}:
for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*");
do

Thank you!
Dam


Bug#923210: bash-completion: postinst and postrm generate find warnings

2019-02-27 Thread Gabriel F. T. Gomes
On Sun, Feb 24 2019, Daniel Lewart wrote:
> Package: bash-completion
> Version: 1:2.8-5
> Severity: minor
> Tags: patch
> 
> Both "apt install bash-completion" and "apt purge bash-completion"
> generate the following warning:
>   find: '/etc/bash_completion.d/': No such file or directory
> 
> The cause is that postinst and postrm assume that
> /etc/bash_completion.d exists.
> 
> Patch is attached.

Thanks.

I have a comment about a hunk in the patch and a question, here:

Is it safe to upload such a change so close to the freeze?  I'm always
worried about unforeseen side-effects.

> diff -ru a/debian/postinst b/debian/postinst
> --- a/debian/postinst 2018-12-21 19:23:09.0 -0600
> +++ b/debian/postinst 2019-02-24 00:00:00.0 -0600
> @@ -4,19 +4,21 @@
>  
>  case "$1" in
>  configure)
> -# let's remove old bash-completion conffiles
> -for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*"); do
> -dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- "$@"
> -done
> +if [ -d /etc/bash_completion.d ]; then
> +# let's remove old bash-completion conffiles
> +for f in $(find /etc/bash_completion.d/ -type f -name 
> "*.dpkg-*"); do
> +dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- 
> "$@"
> +done

OK.

> -if dpkg --compare-versions "$2" le "1:2.1-3"; then
> -if [ -d /etc/bash_completion.d/helpers ]; then
> -rmdir --ignore-fail-on-non-empty 
> /etc/bash_completion.d/helpers 2>/dev/null
> +if dpkg --compare-versions "$2" le "1:2.1-3"; then
> +if [ -d /etc/bash_completion.d/helpers ]; then
> +rmdir --ignore-fail-on-non-empty 
> /etc/bash_completion.d/helpers 2>/dev/null
> +fi
> +# disabled from Ubuntu, third party packages might have 
> installed things here
> +#if [ -d /etc/bash_completion.d ]; then
> +#rmdir --ignore-fail-on-non-empty /etc/bash_completion.d 
> 2>/dev/null
> +#fi
>  fi
> -# disabled from Ubuntu, third party packages might have 
> installed things here
> -#if [ -d /etc/bash_completion.d ]; then
> -#rmdir --ignore-fail-on-non-empty /etc/bash_completion.d 
> 2>/dev/null
> -#fi
>  fi
>   ;;
>  abort-upgrade|abort-remove|abort-deconfigure)

Is this hunk needed?  The test (-d /etc/bash_completion.d/helpers) is
not likely to produce the warnings you mentioned.

> diff -ru a/debian/postrm b/debian/postrm
> --- a/debian/postrm   2018-12-21 19:23:09.0 -0600
> +++ b/debian/postrm   2019-02-24 00:00:00.0 -0600
> @@ -5,10 +5,12 @@
>  case "$1" in
>  purge)
>   rm -f /etc/bash_completion
> -# let's remove old bash-completion conffiles
> -for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*"); do
> -dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- "$@"
> -done
> + if [ -d /etc/bash_completion.d ]; then
> +# let's remove old bash-completion conffiles
> +for f in $(find /etc/bash_completion.d/ -type f -name 
> "*.dpkg-*"); do
> +dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- 
> "$@"
> +done
> + fi
>   ;;
>  remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
>   ;;

OK.



Bug#923210: bash-completion: postinst and postrm generate find warnings

2019-02-24 Thread Daniel Lewart
Package: bash-completion
Version: 1:2.8-5
Severity: minor
Tags: patch

Gabriel, et al,

Both "apt install bash-completion" and "apt purge bash-completion"
generate the following warning:
find: '/etc/bash_completion.d/': No such file or directory

The cause is that postinst and postrm assume that
/etc/bash_completion.d exists.

Patch is attached.

Thank you!
Daniel Lewart
diff -ru a/debian/postinst b/debian/postinst
--- a/debian/postinst   2018-12-21 19:23:09.0 -0600
+++ b/debian/postinst   2019-02-24 00:00:00.0 -0600
@@ -4,19 +4,21 @@
 
 case "$1" in
 configure)
-# let's remove old bash-completion conffiles
-for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*"); do
-dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- "$@"
-done
+if [ -d /etc/bash_completion.d ]; then
+# let's remove old bash-completion conffiles
+for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*"); 
do
+dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- 
"$@"
+done
 
-if dpkg --compare-versions "$2" le "1:2.1-3"; then
-if [ -d /etc/bash_completion.d/helpers ]; then
-rmdir --ignore-fail-on-non-empty 
/etc/bash_completion.d/helpers 2>/dev/null
+if dpkg --compare-versions "$2" le "1:2.1-3"; then
+if [ -d /etc/bash_completion.d/helpers ]; then
+rmdir --ignore-fail-on-non-empty 
/etc/bash_completion.d/helpers 2>/dev/null
+fi
+# disabled from Ubuntu, third party packages might have 
installed things here
+#if [ -d /etc/bash_completion.d ]; then
+#rmdir --ignore-fail-on-non-empty /etc/bash_completion.d 
2>/dev/null
+#fi
 fi
-# disabled from Ubuntu, third party packages might have installed 
things here
-#if [ -d /etc/bash_completion.d ]; then
-#rmdir --ignore-fail-on-non-empty /etc/bash_completion.d 
2>/dev/null
-#fi
 fi
;;
 abort-upgrade|abort-remove|abort-deconfigure)
diff -ru a/debian/postrm b/debian/postrm
--- a/debian/postrm 2018-12-21 19:23:09.0 -0600
+++ b/debian/postrm 2019-02-24 00:00:00.0 -0600
@@ -5,10 +5,12 @@
 case "$1" in
 purge)
rm -f /etc/bash_completion
-# let's remove old bash-completion conffiles
-for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*"); do
-dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- "$@"
-done
+   if [ -d /etc/bash_completion.d ]; then
+# let's remove old bash-completion conffiles
+for f in $(find /etc/bash_completion.d/ -type f -name "*.dpkg-*"); 
do
+dpkg-maintscript-helper rm_conffile ${f%.dpkg-*} 1:1.3-1 -- 
"$@"
+done
+   fi
;;
 remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;