Bug 1304071

Summary: possible sort bug
Product: [Fedora] Fedora Reporter: George R. Goffe <grgoffe>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 22CC: admiller, kdudka, kzak, ooprala, ovasik, p, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-03 08:23:33 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 George R. Goffe 2016-02-02 19:31:58 UTC
Description of problem:
sorting files produces error message for "-S 3g" but NOT for "-S3g".

Version-Release number of selected component (if applicable):
sort 8.23 (coreutils-8.23-11.fc22.x86_64)

How reproducible:
always

Steps to Reproduce:
1.see additional info
2.
3.

Actual results:


Expected results:


Additional info:

# this seems to work

sort -T $sorttmp -S"3g" -uk1 | egrep -v '^$' | egrep '\.com' < 1000s > 1000s.srtd

# this does not note the blank after "-S"

sort -T $sorttmp -S "3g" -uk1 | egrep -v '^$' | egrep '\.com' < 1000s > 1000s.srtd

sort: cannot read: 3g: No such file or directory

which sort

/bin/sort

sort --version
sort (GNU coreutils) 8.23
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.

Comment 1 Kamil Dudka 2016-02-03 08:23:33 UTC
(In reply to George R. Goffe from comment #0)
> # this seems to work
> 
> sort -T $sorttmp -S"3g" -uk1 | egrep -v '^$' | egrep '\.com' < 1000s >
> 1000s.srtd

I guess the only problem is that $sorttmp expands to an empty string.  So in the above case "-S3g" is consumed as an operand of the -T option.

> # this does not note the blank after "-S"
> 
> sort -T $sorttmp -S "3g" -uk1 | egrep -v '^$' | egrep '\.com' < 1000s >
> 1000s.srtd
> 
> sort: cannot read: 3g: No such file or directory

In this case, only "-S" is consumed as operand of the -T option.  So the string "3g" is interpreted as an input file.