Open lbontu opened 8 years ago
What happens when you set LANC=C?
On Fri, Dec 11, 2015 at 2:20 PM, lbontu notifications@github.com wrote:
Something strange is going on I'll dive into the code later to try and help I'm guessing the actual problem has something to do with options handling? Here's how to recreate what I am seeing:
Everything works as expected with normal usage:
$ /tee -af outtxt foo foo ^D $ ls -1 outtxt tee teec
But, if you abuse the options handling a bit and don't provide an output file, this weird file shows up
$ ls -1 tee teec $ /tee -a foo foo ^D $ ls -1 1?I??^H??H???PTI??0?@ tee teec
*short_options contains a seemingly unhandled '-o' option, and this can trigger the issue as well
$ ls -1 tee teec $ /tee -o blah foo foo ^D $ ls -1 1?I??^H??H???PTI??0?@ tee teec
— Reply to this email directly or view it on GitHub https://github.com/jonschipp/systemsprogramming/issues/1.
Jon Schipp, jonschipp.com, sickbits.net, http://goog_1056813495open-nsm.net,
Same thing:
$ export LANG=C
$ rm -f 1*
$ ./tee -a
foo
foo
$ ls
1?I??^H??H???PTI??0?@ tee tee.c
Do you experience this behavior on your machine? Here is the actual filename, if you're curious:
$ ls 1* | cut -c3- | hexdump -C
00000000 49 89 d1 5e 48 89 e2 48 83 e4 f0 50 54 49 c7 c0 |I..^H..H...PTI..|
00000010 30 09 40 0a |0.@.|
I patched the unhandled o option, thanks. Our output differs, what's your system info? Looks like I need required or make a condition for the absence of a file argument. ./tee1 -a open: Bad address foo write: Bad file descriptor foo foo write: Bad file descriptor foo close: Bad file descriptor
On Fri, Dec 11, 2015 at 2:36 PM, lbontu notifications@github.com wrote:
Same thing:
$ export LANG=C $ rm -f 1* $ ./tee -a foo foo $ ls 1?I??^H??H???PTI??0?@ tee tee.c
— Reply to this email directly or view it on GitHub https://github.com/jonschipp/systemsprogramming/issues/1#issuecomment-164041848 .
Jon Schipp, jonschipp.com, sickbits.net, http://goog_1056813495open-nsm.net,
Here's some system information:
$ uname -mor
2.6.32-504.3.3.el6.x86_64 x86_64 GNU/Linux
$ ldd --version | head -n1
ldd (GNU libc) 2.12
$ lsb_release -d
Description: Scientific Linux release 6.7 (Carbon)
Maybe open()
is weird on this system?
Something strange is going on. I'll dive into the code later to try and help. I'm guessing the actual problem has something to do with options handling? Here's how to recreate what I am seeing:
Everything works as expected with normal usage:
But, if you abuse the options handling a bit and don't provide an output file, this weird file shows up.
*short_options
contains a seemingly unhandled -o option, and this can trigger the issue as well.