FS#48908 - [debootstrap] Directly sourcing /etc/makepkg.conf breaks POSIX compatibility

Attached to Project: Community Packages
Opened by Tinu Weber (ayekat) - Tuesday, 12 April 2016, 13:08 GMT
Last edited by Eli Schwartz (eschwartz) - Wednesday, 07 February 2018, 15:56 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No


`arch-detect.patch` adds lines that source `/etc/makepkg.conf` in order to determine the CARCH value.
However, `/etc/makepkg.conf` is written for bash (and thus contains bashisms, like arrays), whereas debootstrap has the `#! /bin/sh` shebang and therefore expects to run on any POSIX-compatible shell, such as dash.

Additional info:
* package version: debootstrap-1.0.80-2-any

Steps to reproduce:
* Make `/bin/sh` a symlink to `/bin/dash`.
* Run `debootstrap x y`.
* See it crash with this error:

/usr/bin/debootstrap: 11: /etc/makepkg.conf: Syntax error: "(" unexpected

I have attached an updated `arch-detect.patch` that correctly wraps the sourcing of `/etc/makepkg.conf` in bash. However, this would add a dependency on bash, so it an alternative fix would perhaps be to manually extract the CARCH value.
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Wednesday, 07 February 2018, 15:56 GMT
Reason for closing:  Fixed
Additional comments about closing:  debootstrap 1.0.93-2
Comment by Tinu Weber (ayekat) - Thursday, 24 August 2017, 11:10 GMT
Is there anything blocking this from being fixed? I'm still running into this issue with 1.0.91-1.

Since I'm not sure if the above patch is still valid, I have attached an up-to-date patch for `arch-detect.patch` to this comment.
Comment by Eli Schwartz (eschwartz) - Wednesday, 07 February 2018, 15:55 GMT
Thanks, I've uploaded a new version with a fixed patch, that contains your fix plus a comment noting that we can move to `pacman-conf Architecture` as soon as pacman 5.1 is released. (pacman 5.1 will probably be released in March.)

pacman-conf was added in these commits BTW: