sort utility goes berzerk (x86_64)

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Wed Nov 29 22:39:00 GMT 2017


On 2017-11-28 10:12, Houder wrote:
> On 2017-11-28 14:37, Doug Henderson wrote:
> 
>>>>> On 2017-11-25 14:23, Houder wrote:
>>>>> > Hi,
>>>>> >
>>>>> > Anyone seeing this as well? sort goes berzerk on my system when piped
>>>>> > into
>>>>> > head (or less) when it is fed with a 'specially prepared' input file.
>>>>> >
>>>>> >  - only happens on x86_64
>>>>> >  - does not happen for 'LC_COLLATE=C sort tt | head'
>>>>> >
>>>>> > 'specially prepared' input file? (see bottom of post).
>>>>>
>>>>> Anyone ** NOT ** seeing this?
> 
>> Q4. After you kill a hung sort, are there files left over in /tmp? I
>> am wondering if the problem files are too big to do an in-core sort,
>> and something goes wrong when it switches to a temp file sort, but not
>> for smaller or larger input files where it correctly predicts which
>> type of sort it needs to do. Possibly using the "--buffer-size=N"
>> option will change the behavior, making smaller input files fail and
>> failing ones work.

> sort should not fail in the way it does; it does not on "Cygwin/x86" on
> my machine; it does not on Linux (Fedora 24) (same machine).

No problems with many sizes, Cygwin or Windows sort, under bash or dash.

Have you checked for permissions problems on $TMPDIR if set, or /tmp?
My TMPDIR=/tmp - try:
$ ls -dl	$TMPDIR /tmp
drwxrwxrwt+ 1 <USER> Users 0 Nov 29 15:24 /tmp
...
$ getfacl	$TMPDIR /tmp
# file: /tmp
# owner: <USER>
# group: Users
# flags: --t
user::rwx
group::rwx
other:rwx
default:user::rwx
default:group::r-x
default:other:r-x
...
$ icacls `cygpath -m $TMPDIR`
C:/<PATH>/tmp NULL SID:(DENY)(Rc,S,RD)
                          <HOST>\<USER>:(F)
                          BUILTIN\Users:(RX,W)
                          Everyone:(RX,W)
                          CREATOR OWNER:(OI)(CI)(IO)(F)
                          CREATOR GROUP:(OI)(CI)(IO)(RX)
                          Everyone:(OI)(CI)(IO)(RX)
$ icacls `cygpath -m /tmp`
...

and maybe try specifying an explicit temp dir using e.g. sort -T $HOME/

Maybe also check if any limits:
$ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 8
stack size              (kbytes, -s) 2032
cpu time               (seconds, -t) unlimited
max user processes              (-u) 256
virtual memory          (kbytes, -v) unlimited

Maybe try reinstalling coreutils in a standalone setup run?

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list