Bug 664699 - xorg-x11-fonts-update-dirs is not a /bin/sh script
Summary: xorg-x11-fonts-update-dirs is not a /bin/sh script
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: xorg-x11-font-utils
Version: 14
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Matěj Cepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-21 12:03 UTC by Ralf Corsepius
Modified: 2018-04-11 09:13 UTC (History)
3 users (show)

Fixed In Version: xorg-x11-font-utils-7.4-4.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-25 00:25:53 UTC


Attachments (Terms of Use)

Description Ralf Corsepius 2010-12-21 12:03:19 UTC
Description of problem:

xorg-x11-fonts-update-dirs is not a /bin/sh script, because this script applies pushd+popd, which both are non-POSIX-sh-extensions.


Version-Release number of selected component (if applicable):
xorg-x11-font-utils-7.4-3.fc14.x86_64


Steps to Reproduce:
Try to run this scipt with ksh:

# /bin/ksh xorg-x11-fonts-update-dirs --skip-fontscale /usr/share/X11/fonts/misc
xorg-x11-fonts-update-dirs[54]: pushd: not found [No such file or directory]
xorg-x11-fonts-update-dirs: line 56: popd: not found
  
Expected results:
A /bin/sh script should be POSIX-sh compliant,

=> either this script should change to using the shebang of a shell 
supporting pushd+popd (e.g. #!/bin/bash) or the script be rewritten (esp. to not
use pushd+popd)

Comment 1 Matěj Cepl 2010-12-21 14:41:40 UTC
What do you think about the patch in attachment 469993 [details] ?

Comment 2 Ralf Corsepius 2010-12-21 15:44:56 UTC
(In reply to comment #1)
> What do you think about the patch in attachment 469993 [details] ?

OK, that's the classic subshell pushd/popd approach - I don't any reason why it shouldn't work. It's advantage is it being usable should once a loop be introduced around the pushd/popd, it's downside it the subshell having its price.

An alternative would be the "save pwd" approach.
sav_pwd=`pwd`
cd <somewhere>
do-something
cd ${sav_pwd}
This would avoid the subshell and therefore is somewhat less expensive, but it would not be suitable for "loops".

AFAIS, ATM the latter alternative would suffice.

Comment 3 Ralf Corsepius 2010-12-21 15:47:00 UTC
Urgh, this was badly phrased, I was referring to "recursive loops", not "flat loops".

Comment 4 Fedora Update System 2010-12-22 13:36:25 UTC
xorg-x11-font-utils-7.4-4.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/xorg-x11-font-utils-7.4-4.fc14

Comment 5 Fedora Update System 2010-12-22 19:54:11 UTC
xorg-x11-font-utils-7.4-4.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update xorg-x11-font-utils'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/xorg-x11-font-utils-7.4-4.fc14

Comment 6 Fedora Update System 2010-12-25 00:25:44 UTC
xorg-x11-font-utils-7.4-4.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.