** Description changed:

  Problem with qemu-arm-static version 1:6.0+dfsg-2expubuntu1, as of recent 
Impish
  When using qemu-arm-static for cross-debootstrap for an ARM machine argument 
0 of the invoked ARM program does not contain the name of the executable but 
argument 1, argument 2 is passed as argument 1 and so forth.
  Thus all program calls are missing the 1st argument.
  Eample: A shell script test.sh
  
  -- Start --------------------
  #!/bin/sh
  
  echo "\$0=$0"
  echo "\$1=$1"
- echo "\$1=$2"
+ echo "\$2=$2"
  echo "\$*=$*"
  -- End --------------------
  
  Running the script as "./test.sh a bb ccc dddd" emits:
  $0=./test.sh
  $1=a
  $2=bb
  $*=a bb ccc dddd
  
  Reproduce the erroneous behavior of qemu-arm-static
  Create a directory armTest. Enter:
  sudo debootstrap --foreign --verbose --arch=armhf impish armTest
  sudo cp test.sh armTest
  sudo cp -v /usr/bin/qemu-arm-static armTest/usr/bin
  
  Now run
  sudo chroot armTest ./test.sh a bb ccc dddd
  The script is now run by the shell for the ARM architecture, and is invoked 
by qemu-arm-static.
  The script now emits
  $0=a
  $1=bb
  $2=ccc
  $*=bb ccc dddd
  
  argument 0 (the program name) disappeared, and all arguments are shifted
  up.
  
  Evidence that actually qemu-arm-static is the culprit:
  In /etc/apt/sources.list add the hirsute main, main-update, universe and 
universe-update repositories. Enter:
  sudo apt-get update
  sudo apt-get install qemu-user-static/hirsute
  
  Confirm that you want to downgrade the program to version
  1:5.2+dfsg-9ubuntu3.2 (of hirsute-update).
  
  Copy the downgraded qemu-arm-static to armTest/usr/bin. Repeat the
  chroot command. Now the result is the same as invoking test.sh directly
  under your x86_64 architecture.
  
  This bug does not only affect shell scripts. Apparently all programs are
  affected by the shifted program arguments.
  
  This bug makes a complete cross-debootstrap impossible because the
  second debootstrap stage is run as chroot in the target architecture.
  Further steps to prepare a ready-to-boot image/SD card are equally
  impossible.
  
  ProblemType: Bug
  DistroRelease: Ubuntu 21.10
  Package: qemu-user-static 1:6.0+dfsg-2expubuntu1
  ProcVersionSignature: Ubuntu 5.13.0-20.20-generic 5.13.14
  Uname: Linux 5.13.0-20-generic x86_64
  ApportVersion: 2.20.11-0ubuntu70
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: LXQt
  Date: Wed Oct 20 13:35:52 2021
  KvmCmdLine: COMMAND         STAT  EUID  RUID     PID    PPID %CPU COMMAND
  MachineType: VMware, Inc. VMware Virtual Platform
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.13.0-20-generic 
root=UUID=f5ea75df-ad8e-4112-8537-372efa9f6a4b ro splash quiet
  SourcePackage: qemu
  UpgradeStatus: Upgraded to impish on 2021-10-16 (3 days ago)
  dmi.bios.date: 11/12/2020
  dmi.bios.release: 4.6
  dmi.bios.vendor: Phoenix Technologies LTD
  dmi.bios.version: 6.00
  dmi.board.name: 440BX Desktop Reference Platform
  dmi.board.vendor: Intel Corporation
  dmi.board.version: None
  dmi.chassis.asset.tag: No Asset Tag
  dmi.chassis.type: 1
  dmi.chassis.vendor: No Enclosure
  dmi.chassis.version: N/A
  dmi.ec.firmware.release: 0.0
  dmi.modalias: 
dmi:bvnPhoenixTechnologiesLTD:bvr6.00:bd11/12/2020:br4.6:efr0.0:svnVMware,Inc.:pnVMwareVirtualPlatform:pvrNone:sku:rvnIntelCorporation:rn440BXDesktopReferencePlatform:rvrNone:cvnNoEnclosure:ct1:cvrN/A:
  dmi.product.name: VMware Virtual Platform
  dmi.product.version: None
  dmi.sys.vendor: VMware, Inc.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1947860

Title:
  qemu-arm-static swallows the program name, and shifts all arguments
  left

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1947860/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to