FS#53245 - [flatpak] Invalid syntax in /etc/profile.d/flatpak.sh

Attached to Project: Arch Linux
Opened by Peter Fern (pdf) - Saturday, 11 March 2017, 00:11 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Tuesday, 21 March 2017, 15:39 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Line 7 of /etc/profile.d/flatpak.sh uses invalid comparison operator:

elif [ "${XDG_DATA_DIRS#*flatpak}" == "${XDG_DATA_DIRS}" ]; then

Should be a single equals sign.

Not sure how to tell if this comes from upstream or Arch.

Additional info:
* package version: 0.8.4-1
Patch attached

Steps to reproduce:
* Spawn a shell that imports /etc/profile.d/*.sh

/etc/profile.d/flatpak.sh:7: = not found
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Tuesday, 21 March 2017, 15:39 GMT
Reason for closing:  Fixed
Comment by Doug Newgard (Scimmia) - Saturday, 11 March 2017, 04:11 GMT
It comes from upstream: https://github.com/flatpak/flatpak/blob/master/profile/flatpak.sh.in

"==" is a bashism, so I'm assuming you're running a non-bash compatible shell. It should definitely be fixed, though.
Comment by Peter Fern (pdf) - Saturday, 11 March 2017, 05:51 GMT
Ah, I thought that even in bash it would only work inside double-brackets (extended test command), however it appears I was mistaken, and you are correct that I am using a non-bash shell. I've submitted a PR upstream:

Comment by Bartłomiej Piotrowski (Barthalion) - Saturday, 11 March 2017, 19:47 GMT
The mentioned pull request has been closed in favor of different one, but for now I guess it's enough to run s/==/=/ on said faile.
Comment by Peter Fern (pdf) - Saturday, 11 March 2017, 21:48 GMT
I closed it in favour of a more comprehensive PR from one of the Debian devs - Simon rightly identified some other potential issues, like spaces in XDG_DATA_DIRS causing it to blow up. I'd be inclined to consider pulling in 36a7fa1 as a patch.