Bug 1245302 - Running 'rescan-scsi-bus -u' deletes /dev/null
Summary: Running 'rescan-scsi-bus -u' deletes /dev/null
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sg3_utils
Version: 6.6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: David Sommerseth
QA Contact: Jan Kepler
Petr Bokoc
URL:
Whiteboard:
Depends On:
Blocks: 1172231 1254457 1298737 1300338
TreeView+ depends on / blocked
 
Reported: 2015-07-21 17:27 UTC by John Pittman
Modified: 2019-10-10 09:58 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
"rescan-scsi-bus.sh" no longer removes `/dev/null` When running the "rescan-scsi-bus.sh" script, due to incorrect syntax in redirecting output to the `/dev/null` device file while executing the `/bin/rm` utility, the redirection did not happen but `/dev/null` was instead interpreted as a file to be removed. As a consequence, running "rescan-scsi-bus.sh" with the "--update" option removed `/dev/null` during execution. This bug has been fixed, and /dev/null is no longer removed by "rescan-scsi-bus.sh".
Clone Of:
: 1298737 1300338 (view as bug list)
Environment:
Last Closed: 2016-05-11 00:29:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed patches for RHEL6 and 7 (949 bytes, application/x-gzip)
2015-07-21 20:36 UTC, John Pittman
no flags Details
Fix /dev/null redirect mistakes (3.82 KB, text/plain)
2015-12-18 18:28 UTC, David Sommerseth
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0905 0 normal SHIPPED_LIVE sg3_utils bug fix update 2016-05-10 22:51:23 UTC

Description John Pittman 2015-07-21 17:27:10 UTC
Description of problem:

When running the command 'rescan-scsi-bus.sh -u' the /dev/null file will be deleted.

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

sg3_utils-1.28-6.el6.x86_64
sg3_utils-libs-1.28-6.el6.x86_64

2.6.32-504.16.2.el6.x86_64

Issue also present in RHEL7 at levels:

sg3_utils-libs-1.37-5.el7.x86_64
sg3_utils-1.37-5.el7.x86_64
3.10.0-229.el7.x86_64

How reproducible:

[root@rhel6a ~]# cat test.sh 
#/bin/bash

rm tmp.out 2&>1 /dev/null

[root@rhel6a ~]# touch tmp.out

[root@rhel6a ~]# ls /dev | grep null
null

[root@rhel6a ~]# ./test.sh
[root@rhel6a ~]#

[root@rhel6a ~]# ls | grep tmp.out
[root@rhel6a ~]#

[root@rhel6a ~]# ls /dev | grep null
[root@rhel6a ~]# 

[root@rhel6a ~]# udevadm trigger
[root@rhel6a ~]# 

[root@rhel6a ~]# ls /dev | grep null
null

Actual results:

The following on line 725 removes /dev/null because of the 2&>1

rm $tmpfile 2&>1 /dev/null

The set -x output shows:

+ rm /tmp/rescan-scsi-bus-s 2 /dev/null

* Issue does not reproduce if I change 2&>1 to either of the following:

2>
&>

* It does reproduce if I use 2>&1.

Expected results:

/dev/null not be deleted.

If I can be of any help please let me know.

John

Comment 2 John Pittman 2015-07-21 20:36:50 UTC
Created attachment 1054528 [details]
proposed patches for RHEL6 and 7

Comment 4 David Sommerseth 2015-12-18 18:28:03 UTC
Created attachment 1107282 [details]
Fix /dev/null redirect mistakes

Updated the proposed patches with the new attachment (0001-Fix-dev-null-redirect-mistakes.patch), plus submitted it upstream.

Scratch build available here: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=10254401
Will wait for a final build when more issues from other bzs have considered.

Comment 10 errata-xmlrpc 2016-05-11 00:29:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0905.html


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