FS#53646 - pacman's output breaks bash, causes posix mode

Attached to Project: Pacman
Opened by MechaLynx (MechaLynx) - Wednesday, 12 April 2017, 04:57 GMT
Last edited by Andrew Gregory (andrewgregory) - Wednesday, 12 April 2017, 13:09 GMT
Task Type Bug Report
Category Output
Status Closed
Assigned To No-one
Architecture x86_64
Severity High
Priority Normal
Reported Version 5.0.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:

Allowing pacman to produce output can change bash's behavior, specifically breaking behavior when sourcing files. Redirecting output prevents this.

Steps to Reproduce:

- start a bash script that sets extglob
- source a file that requires extglob to work
- call pacman after sourcing the file
- sourcing breaks

Test code: https://gist.github.com/MechaLynx/12b6f8898c80004e0052c57bffc2c824
Output: http://imgur.com/zXP656h

Tested on the live archiso distribution, booted from the latest iso (april 2017)
This task depends upon

Closed by  Andrew Gregory (andrewgregory)
Wednesday, 12 April 2017, 13:09 GMT
Reason for closing:  Upstream
Comment by MechaLynx (MechaLynx) - Wednesday, 12 April 2017, 04:59 GMT
Forgot to add that I tried dumping pacman's output to see if there's special unprintable characters that cause this and found no unprintables with vim and less.

edit - Some discussion on #bash on freenode has revealed that it is the environment exported to pacman due to `set -a' that's causing the issue, since pacman tries to import the environment twice and because `extglob' isn't exported, it fails the import. Making sure `set +a' is used before calling pacman should be a practical workaround. Thanks to twkm and geirha on #bash. Not sure if this counts as a pacman bug anymore, however, it does show that pacman spawns at least 2 new bash environments to do its printing, while it doesn't spawn any if printing is redirected. I guess it counts as a bug if this forking can be avoided, but I guess that's asking too much.
Comment by Andrew Gregory (andrewgregory) - Wednesday, 12 April 2017, 12:08 GMT
I don't see how there's anything here that could be considered a pacman bug. Pacman is a C program, it doesn't spawn anything for printing.

Loading...