Bug 664699

Summary: xorg-x11-fonts-update-dirs is not a /bin/sh script
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: xorg-x11-font-utilsAssignee: Matěj Cepl <mcepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: fonts-bugs, mcepl, xgl-maint
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: xorg-x11-font-utils-7.4-4.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-25 00:25:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.