On 21/02/14 16:10, Guillem Jover wrote:
Control: reopen -1

On Fri, 2014-02-21 at 11:07:38 +0100, Eugen Dedu wrote:
On 20/02/14 21:38, Guillem Jover wrote:
On Thu, 2014-02-20 at 18:23:59 +0100, Eugen Dedu wrote:
I need to use dir_to_symlink and see in 'man dpkg-maintscript-helper':

"[...] we can call the program only if we know that the required
command is supported by the currently installed dpkg:
      if dpkg-maintscript-helper supports command; then
          dpkg-maintscript-helper command ...
      fi
"

On my computer dpkg-maintscript-helper supports always returns 1:

snoopy:~$ dpkg-maintscript-helper supports dir_to_symlink; echo $?
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_NAME 
missing
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_PACKAGE 
missing
1
snoopy:~$ dpkg-maintscript-helper supports fasdfa; echo $?
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_NAME 
missing
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_PACKAGE 
missing
1
snoopy:~$ dpkg-maintscript-helper supports xyz; echo $?
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_NAME 
missing
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_PACKAGE 
missing
1

Tha's because the mentioned variables are not defined in the
environment, as dpkg does. Check this instead:

   $ env DPKG_MAINTSCRIPT_NAME=postinst DPKG_MAINTSCRIPT_PACKAGE=pkg \
     dpkg-maintscript-helper supports dir_to_symlink
   $ echo $?
   0

I'm thus closing this bug report.

May I suggest to add this information on the man page?  I think it
is not evident to see that the program might give different results
depending on the environment variables.  (By the way, I myself do
not see why it gives different results.)

Ok, I'm adding that explicitly, although it's implicitly already there,
when mentioning the environment variables and given that the program is
a maintscript helper, but I guess it might not be obvious.

If gives different results, because if those envvars are not defined
then the commands will always fail, which is the equivalent of not
supporting them.

Sorry to ask again: why do these commands fail if no env var is set? It is a matter of checking if dpkg supports some command or not. Is this done voluntarily (why?) or it is a limitation (bug) in the program?

Perhaps I miss something here?

--
Eugen


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to