Re: globus-net-manager FTBFS during python 3.10 transition

Laurent Vivier <[email protected]> Wed, 27 Apr 2022 11:04:01 +0200
Newsgroups gmane.linux.debian.ports.superh,gmane.linux.debian.ports.68k
Message-ID <[email protected]>
Le 26/04/2022 à 21:24, John Paul Adrian Glaubitz a écrit :
> Hi!
> 
...
>> [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=974004
> 
Normally, since qemu v6.0.0 you can preserve argv[0]:

commit 6e1c0d7b951e19c53b8467e8bc4b71ee73a394ea
Author: Laurent Vivier <[email protected]>
Date:   Mon Feb 22 11:50:04 2021 +0100

     linux-user: manage binfmt-misc preserve-arg[0] flag

     Add --preserve-argv0 in qemu-binfmt-conf.sh to configure the preserve-argv0
     flag.

     This patch allows to use new flag in AT_FLAGS to detect if
     preserve-argv0 is configured for this interpreter:
     argv[0] (the full pathname provided by binfmt-misc) is removed and
     replaced by argv[1] (the original argv[0] provided by binfmt-misc when
     'P'/preserve-arg[0] is set)

     For instance with this patch and kernel support for AT_FLAGS:

       $ sudo chroot m68k-chroot sh -c 'echo $0'
       sh

     without this patch:

       $ sudo chroot m68k-chroot sh -c 'echo $0'
       /usr/bin/sh

     The new flag is available in kernel (v5.12) since:
     2347961b11d4 ("binfmt_misc: pass binfmt_misc flags to the interpreter")

     This can be tested with something like:

       # cp ..../qemu-ppc /chroot/powerpc/jessie

       # qemu-binfmt-conf.sh --qemu-path / --systemd ppc --credential yes \
                             --persistent no --preserve-argv0 yes
       # systemctl restart systemd-binfmt.service
       # cat /proc/sys/fs/binfmt_misc/qemu-ppc
       enabled
       interpreter //qemu-ppc
       flags: POC
       offset 0
       magic 7f454c4601020100000000000000000000020014
       mask ffffffffffffff00fffffffffffffffffffeffff
       # chroot /chroot/powerpc/jessie  sh -c 'echo $0'
       sh

       # qemu-binfmt-conf.sh --qemu-path / --systemd ppc --credential yes \
                             --persistent no --preserve-argv0 no
       # systemctl restart systemd-binfmt.service
       # cat /proc/sys/fs/binfmt_misc/qemu-ppc
       enabled
       interpreter //qemu-ppc
       flags: OC
       offset 0
       magic 7f454c4601020100000000000000000000020014
       mask ffffffffffffff00fffffffffffffffffffeffff
       # chroot /chroot/powerpc/jessie  sh -c 'echo $0'
       /bin/sh

     Signed-off-by: Laurent Vivier <[email protected]>
     Message-Id: <[email protected]>

You need also kernel v5.12:

commit 2347961b11d4079deace3c81dceed460c08a8fc1
Author: Laurent Vivier <[email protected]>
Date:   Tue Jan 28 14:25:39 2020 +0100

     binfmt_misc: pass binfmt_misc flags to the interpreter

     It can be useful to the interpreter to know which flags are in use.

     For instance, knowing if the preserve-argv[0] is in use would
     allow to skip the pathname argument.

     This patch uses an unused auxiliary vector, AT_FLAGS, to add a
     flag to inform interpreter if the preserve-argv[0] is enabled.

     Note by Helge Deller:
     The real-world user of this patch is qemu-user, which needs to know
     if it has to preserve the argv[0]. See Debian bug #970460.

     Signed-off-by: Laurent Vivier <[email protected]>
     Reviewed-by: YunQiang Su <[email protected]>
     URL: http://bugs.debian.org/970460
     Signed-off-by: Helge Deller <[email protected]>

Thanks,
Laurent