Bug 1009639

Summary: /dev/fd/ symlink missing
Product: Red Hat Enterprise Linux 7 Reporter: Jan Pokorný [poki] <jpokorny>
Component: anacondaAssignee: Vratislav Podzimek <vpodzime>
Status: CLOSED WORKSFORME QA Contact: Release Test Team <release-test-team-automation>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.0CC: jdisnard, jpokorny, sbueno, vpodzime
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 814850 Environment:
Last Closed: 2013-09-23 18:52:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Pokorný [poki] 2013-09-18 18:59:41 UTC
Not sure if anything changed for el7, but if not, "image changes" [*] are
hopefully still possible.

[*] from orginal bug:

> Don't really want to make any install image changes in RHEL-6


+++ This bug was initially created as a clone of Bug #814850 +++

Description of problem:

The /dev/fd --> /proc/self/fd symbolic link does not exist inside the initrd used by Anaconda as of RHEL 6.2. This may cause problems for Bash scripts that use redirected input. This is an easy fix, without any obvious risks. It would help people using bash script in pre/post during kickstart installation. 



Version-Release number of selected component (if applicable):


How reproducible: 100% reproducible.



Steps to Reproduce:
1. Switch to tty2
2. less < <(cat /tmp/anaconda.log)
3.

 
Actual results:

# Here is some imaginary code
# less < <(cat /tmp/anaconda.log)
bash: /dev/fd/62: No such file or directory


Expected results:
In the above example the input would be redirected if bash could access /dev/fd/[n]


Additional info:

Here is the bash documentation that deals with redirection, you will see that /dev/fd/[n] is documented there. Without a /dev/fd/ (symlink to /proc/self/fd/ bash will have problems for post & pre scripts. 

http://www.gnu.org/software/bash/manual/html_node/Redirections.html

Comment 1 Samantha N. Bueno 2013-09-18 19:09:53 UTC
(In reply to Jan Pokorný from comment #0)
> Not sure if anything changed for el7, but if not, "image changes" [*] are
> hopefully still possible.

Please at least verify whether or not something has changed since rhel06 before opening a bug about it.

Comment 3 Jon Disnard 2013-09-18 20:44:35 UTC
I reported the original problem, thanks for opening this again. =)

According to Harold Hoyer the issue still exists for Dracut generated ramdisk images (E.G. Anaconda boot images) on Fedora 19.

Comment 4 Jan Pokorný [poki] 2013-09-18 21:58:02 UTC
Samantha, I'm sorry for the rush but it's like RHEL7 now or never, it seems.

In fact the script as in [bug 1009596] worked well in el7 snapshot.
Strange.  Will provide more info.

Comment 5 Jon Disnard 2013-09-18 22:54:49 UTC
(In reply to Jan Pokorný from comment #4)
> Samantha, I'm sorry for the rush but it's like RHEL7 now or never, it seems.
> 
> In fact the script as in [bug 1009596] worked well in el7 snapshot.
> Strange.  Will provide more info.

Can you please give a generic example of the process substitution in bash?

If your process substitution uses <(list) then it would fail unless the symbolic link exists from /dev/fd/ to /proc/self/fd

Follow the steps to reproduce in Bug #814850

Comment 6 Jan Pokorný [poki] 2013-09-19 12:43:06 UTC
Jon, the respective part of %post, used both for el6.5 (as in
[bug 1009596]) and el7 snapshots, looked like this in my case:

> %post
> rpm -Uvh "http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm"
> mv /etc/yum.repos.d/epel.repo{,.orig}
> # this is quick'n'dirty way to add excludes (no checks + debug package handling)
> echo "exclude=python-repoze-who-friendlyform" | cat  	<(head -n+2 /etc/yum.repos.d/epel.repo.orig) 	- 	<(tail -n+3 /etc/yum.repos.d/epel.repo.orig) 	>/etc/yum.repos.d/epel.repo
> %end

(it was arranged like that as the ks file itself was generated by a script)

I tried a new el7 snapshot installation during which I switched to tty2 and here,
I could observe that /dev/fd is indeed a symlink to /proc/self/fd.  So it might
have been fixed on this underlying level; some pointers:

- early fix in dracut:
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=f2a716d47ccc2e7c7db97b0a11df1213890cf0a5
- however it is also in RHEL-6 branch?
http://git.kernel.org/cgit/boot/dracut/dracut.git/tree/modules.d/99base/init?h=RHEL-6&id=f2a716d47ccc2e7c7db97b0a11df1213890cf0a5
- and dracut itself still has issues with process substitution?
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=dba2055979aabc5140ee3e607deed4aa390f4ae1
- 1y+ log showing that dracut was indeed creating the symlink in el7
https://bugzilla.redhat.com/show_bug.cgi?id=829682#c18

Comment 7 Vratislav Podzimek 2013-09-23 18:52:51 UTC
Can anybody confirm this issue really happens in el7 tree? I've just tested it and I worked for me. So I'm closing this bug as WORKSFORME. If anybody hits it, please reopen the bug.

Comment 8 Vratislav Podzimek 2013-09-23 18:55:10 UTC
I also believe that this bug doesn't depend on the RHEL 6 one.

Comment 9 Jan Pokorný [poki] 2013-09-23 19:03:39 UTC
Completely agreed, good to see things are better already.

Re dependency: this is a feature of "bug clone" (that I am not exactly
motivated to fight with) rather than anything intentional.