Bug 650103 - /etc/init.d/functions: line 51: /dev/stderr: Permission denied
Summary: /etc/init.d/functions: line 51: /dev/stderr: Permission denied
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 14
Hardware: i686
OS: Linux
low
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-05 08:26 UTC by Jordan Russell
Modified: 2014-03-17 03:25 UTC (History)
7 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2011-02-27 04:53:39 UTC


Attachments (Terms of Use)
CONSOLETYPE - check read access to /dev/stderr (997 bytes, patch)
2010-12-01 11:30 UTC, Petr Lautrbach
no flags Details | Diff

Description Jordan Russell 2010-11-05 08:26:53 UTC
Description of problem:
Beginning in F14, sourcing /etc/init.d/functions from a non-root cron job produces:

/etc/init.d/functions: line 51: /dev/stderr: Permission denied

Version-Release number of selected component (if applicable):
initscripts-9.20.1-1.fc14.i686

Steps to Reproduce:
echo '* * * * * someuser /bin/sh /etc/init.d/functions' >/etc/cron.d/TEST
  
Actual results:
An e-mail containing the above error is received every time the job runs.

Expected results:
No error.

Comment 1 Petr Lautrbach 2010-11-05 13:42:00 UTC
crond attaches stderr of process to pipe - 
l-wx------. /proc/self/fd/2 -> pipe:[6373385]

this [1] commit changed detection of console type from stdin to stderr and spread this bug.

possible solution could be test if stderr is readable or revert this patch.

[1] http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=f27b9adb57c38b296add2f5ee8bfed47cfdd013a;hp=9a4b00572b74450950e53d3c112070b7a20f156b

Comment 2 Vadym Chepkov 2010-11-21 09:18:18 UTC
I actually see an error during the boot too:


		Welcome to Fedora 
/etc/init.d/functions: line 51: /dev/stderr: No such file or directory
Starting udev: udev[300]: starting version 161

initscripts-9.20.1-1.fc14.i686

Comment 4 Petr Lautrbach 2010-12-01 11:30:02 UTC
Created attachment 463951 [details]
CONSOLETYPE - check read access to /dev/stderr

This error is raised by shell running /etc/init.d/functions not by /sbin/consoletype.

$ ls -l stderr 
--w--w----. 1 plautrba plautrba 0 Dec  1 10:03 stderr
$ cat < stderr 2> /dev/null
-bash: stderr: Permission denied
$ sh -c 'cat < stderr' 2> /dev/null
$

This patch checks read access to /dev/stderr before using it.

Comment 5 Bill Nottingham 2010-12-01 20:19:43 UTC
Applied, thx.

Comment 6 Fedora Update System 2011-02-25 20:40:58 UTC
Package initscripts-9.20.2-1.fc14.1:
* should fix your issue,
* was pushed to the Fedora 14 updates-testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing initscripts-9.20.2-1.fc14.1'
as soon as you are able to, then reboot.
Please go to the following url:
https://admin.fedoraproject.org/updates/initscripts-9.20.2-1.fc14.1
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2011-02-26 04:01:01 UTC
initscripts-9.20.2-1.fc14.1 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 initscripts'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/initscripts-9.20.2-1.fc14.1

Comment 8 Fedora Update System 2011-02-27 04:53:06 UTC
initscripts-9.20.2-1.fc14.1 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Neil Bryant 2011-03-25 01:01:33 UTC
Forgive me if this is somehow different. I'm receiving this same error msg from Wicd Network Manager. Searching for clues led me here...

Yum update reports:

Feb 28 06:46:03 Updated: initscripts-9.20.2-1.fc14.1.x86_64

I confirmed that /etc/init.d/functions contains:

------------
# Get a sane screen width
[ -z "${COLUMNS:-}" ] && COLUMNS=80

if [ -z "${CONSOLETYPE:-}" ]; then
  if [ -r "/dev/stderr" ]; then
    CONSOLETYPE="$(/sbin/consoletype < /dev/stderr)"
  else
    CONSOLETYPE="$(/sbin/consoletype)"
  fi
fi
------------

in /var/log/wicd.log:

2011/03/24 19:04:12 :: /etc/init.d/functions: line 53: /dev/stderr: Permission d
enied
2011/03/24 19:04:12 :: /etc/rc.d/init.d/functions: line 53: /dev/stderr: Permission denied


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