mailing list of musl libc
 help / color / mirror / code / Atom feed
* Re: Musl bug, or, am I losing my mind?
       [not found] <2021478498.4444333.1451595055186.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 20:50 ` Guided Muscle
  0 siblings, 0 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 20:50 UTC (permalink / raw)
  To: musl

Rich,

file cdb yields
cdb: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

Obviously, I was able to compile and link a simple file like cdb. LOL.

Relax, you will give yourself a heart attack.
--
GM

--------------------------------------------
On Thu, 12/31/15, Rich Felker <dalias@libc.org> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 3:35 PM
 
 On Thu, Dec 31, 2015 at
 09:34:29PM +0100, Szabolcs Nagy wrote:
 >
 * Guided Muscle <atguarded-gizmo@yahoo.com>
 [2015-12-31 17:31:02 +0000]:
 > >
 Recompiled and installed musl 1.1.12 freshly downloaded from
 the musl web site.
 > > configure;make
 -j2;make install.
 > > 
 > > Oops - just read the INSTALL file in
 the musl 1.1.12 directory. I'm using gcc 4.90.
 > > Installed gcc 4.8; recompiled musl
 1.1.12; 
 > > configure;make -j2;make
 install.
 > > 
 >
 > Test:
 > > lua test.lua | ../cdb
 -c c.cdb
 > > cdb: (stdin): bad
 format
 > > 
 > 
 > i think you still use the old libc.so
 > make install cannot override /lib/ld-*.so
 without root
 > 
 >
 run
 > 
 > lua test.lua
 | musl-build-dir/libc.so ../cdb -c c.cdb
 
 I think he was trying to
 static-link, but adding -static to CFLAGS
 does not do that. It needs to be in LDFLAGS.
 
 Rich
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <1229082331.4470232.1451594892445.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 20:48 ` Guided Muscle
  0 siblings, 0 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 20:48 UTC (permalink / raw)
  To: musl

Hi Szabolcs,
I want to personally thank you, very much, for your help with this issue.
I've moved on. I've found a workaround ...

Thank you.
--
Regards,
GM

--------------------------------------------
On Thu, 12/31/15, Szabolcs Nagy <nsz@port70.net> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 3:34 PM
 
 * Guided Muscle <atguarded-gizmo@yahoo.com>
 [2015-12-31 17:31:02 +0000]:
 > Recompiled and installed musl 1.1.12 freshly downloaded
 from the musl web site.
 > configure;make -j2;make install.
 > 
 > Oops - just read the INSTALL file in the musl 1.1.12
 directory. I'm using gcc 4.90.
 > Installed gcc 4.8; recompiled musl 1.1.12; 
 > configure;make -j2;make install.
 > 
 > Test:
 > lua test.lua | ../cdb -c c.cdb
 > cdb: (stdin): bad format
 > 
 
 i think you still use the old libc.so
 make install cannot override /lib/ld-*.so without root
 
 run
 
 lua test.lua | musl-build-dir/libc.so ../cdb -c c.cdb
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31 20:34   ` Szabolcs Nagy
@ 2015-12-31 20:35     ` Rich Felker
  0 siblings, 0 replies; 19+ messages in thread
From: Rich Felker @ 2015-12-31 20:35 UTC (permalink / raw)
  To: musl

On Thu, Dec 31, 2015 at 09:34:29PM +0100, Szabolcs Nagy wrote:
> * Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-31 17:31:02 +0000]:
> > Recompiled and installed musl 1.1.12 freshly downloaded from the musl web site.
> > configure;make -j2;make install.
> > 
> > Oops - just read the INSTALL file in the musl 1.1.12 directory. I'm using gcc 4.90.
> > Installed gcc 4.8; recompiled musl 1.1.12; 
> > configure;make -j2;make install.
> > 
> > Test:
> > lua test.lua | ../cdb -c c.cdb
> > cdb: (stdin): bad format
> > 
> 
> i think you still use the old libc.so
> make install cannot override /lib/ld-*.so without root
> 
> run
> 
> lua test.lua | musl-build-dir/libc.so ../cdb -c c.cdb

I think he was trying to static-link, but adding -static to CFLAGS
does not do that. It needs to be in LDFLAGS.

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31 17:31 ` Guided Muscle
  2015-12-31 18:33   ` Rich Felker
@ 2015-12-31 20:34   ` Szabolcs Nagy
  2015-12-31 20:35     ` Rich Felker
  1 sibling, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2015-12-31 20:34 UTC (permalink / raw)
  To: musl

* Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-31 17:31:02 +0000]:
> Recompiled and installed musl 1.1.12 freshly downloaded from the musl web site.
> configure;make -j2;make install.
> 
> Oops - just read the INSTALL file in the musl 1.1.12 directory. I'm using gcc 4.90.
> Installed gcc 4.8; recompiled musl 1.1.12; 
> configure;make -j2;make install.
> 
> Test:
> lua test.lua | ../cdb -c c.cdb
> cdb: (stdin): bad format
> 

i think you still use the old libc.so
make install cannot override /lib/ld-*.so without root

run

lua test.lua | musl-build-dir/libc.so ../cdb -c c.cdb


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <786818513.4541881.1451591973977.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 19:59 ` Guided Muscle
  0 siblings, 0 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 19:59 UTC (permalink / raw)
  To: musl

Hi Rich,
Awesome.
BTW, I'm only reporting what I have done. I hope it helped.
Thanks
--
GM

--------------------------------------------
On Thu, 12/31/15, Rich Felker <dalias@libc.org> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 2:45 PM
 
 On Thu, Dec 31, 2015 at 07:35:38PM
 +0000, Guided Muscle wrote:
 > Oh, I wanted to add that this is probably not a cdb bug
 because cdb,
 > when compiled with gcc or clang, worked for i >
 25000.
 
 That doesn't necessarily tell you anything. If the program
 is
 producing undefined behavior, it could appear to work under
 arbitrary
 conditions. Or it might not be producing undefined behavior
 but rather
 just making invalid assumptions about the implementation.
 
 I just tried your test.lua with tinycdb I built myself on
 Alpine Linux
 (x86_64) and could not reproduce the problem. cdb succeeded
 just fine
 reading from pipe. I tried both piping directly from lua,
 and saving
 the output to a file then piping from cat and neither
 produced an
 error.
 
 Rich
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31 19:35 ` Guided Muscle
@ 2015-12-31 19:45   ` Rich Felker
  0 siblings, 0 replies; 19+ messages in thread
From: Rich Felker @ 2015-12-31 19:45 UTC (permalink / raw)
  To: musl

On Thu, Dec 31, 2015 at 07:35:38PM +0000, Guided Muscle wrote:
> Oh, I wanted to add that this is probably not a cdb bug because cdb,
> when compiled with gcc or clang, worked for i > 25000.

That doesn't necessarily tell you anything. If the program is
producing undefined behavior, it could appear to work under arbitrary
conditions. Or it might not be producing undefined behavior but rather
just making invalid assumptions about the implementation.

I just tried your test.lua with tinycdb I built myself on Alpine Linux
(x86_64) and could not reproduce the problem. cdb succeeded just fine
reading from pipe. I tried both piping directly from lua, and saving
the output to a file then piping from cat and neither produced an
error.

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <2036560950.4461281.1451590538227.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 19:35 ` Guided Muscle
  2015-12-31 19:45   ` Rich Felker
  0 siblings, 1 reply; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 19:35 UTC (permalink / raw)
  To: musl

Oh, I wanted to add that this is probably not a cdb bug because cdb, when compiled with gcc or clang, worked for i > 25000.
Thanks!
--
GM
--------------------------------------------
On Thu, 12/31/15, Rich Felker <dalias@libc.org> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 1:33 PM
 
 On Thu, Dec 31, 2015 at
 05:31:02PM +0000, Guided Muscle wrote:
 >
 Recompiled and installed musl 1.1.12 freshly downloaded from
 the musl web site.
 > configure;make
 -j2;make install.
 > 
 >
 Oops - just read the INSTALL file in the musl 1.1.12
 directory. I'm using gcc 4.90.
 >
 Installed gcc 4.8; recompiled musl 1.1.12; 
 > configure;make -j2;make install.
 > 
 > Test:
 > lua test.lua | ../cdb -c c.cdb
 > cdb: (stdin): bad format
 > 
 > I give up and will
 use a temporary file for tinycdb.
 > 
 > Thank you all for your help.
 
 Do you have a sample file we
 could use to reproduce the issue? If the
 output of test.lua is not private data, just
 lua test.lua > sample.txt
 and mailing
 sample.txt to the list would suffice.
 
 Rich
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <1163254146.4344492.1451589596849.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 19:19 ` Guided Muscle
  0 siblings, 0 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 19:19 UTC (permalink / raw)
  To: musl

First, thanks to everyone who's pitched in for this problem.
I'd love to send the sample file to the list but the file is very big about 45MB when i=5000.
Unfortunately, the problem does not rear its head until i is abut 7500.

The output of test.lua is not private and can be easily generated from this lua script:
--
for i=1,10000 do
  key,val="key" .. tostring(i), "value" .. string.rep(tostring(i),i)
  print(string.format("+%d,%d:%s->%s", string.len(key),string.len(val),key,val))
end
print("\n")
--
NOTES:
The problem starts when the loop counter, i, is around 75000.
the final newline are part of the cdb format spec.

Thanks
--
GM
--------------------------------------------
On Thu, 12/31/15, Rich Felker <dalias@libc.org> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 1:33 PM
 
 On Thu, Dec 31, 2015 at
 05:31:02PM +0000, Guided Muscle wrote:
 >
 Recompiled and installed musl 1.1.12 freshly downloaded from
 the musl web site.
 > configure;make
 -j2;make install.
 > 
 >
 Oops - just read the INSTALL file in the musl 1.1.12
 directory. I'm using gcc 4.90.
 >
 Installed gcc 4.8; recompiled musl 1.1.12; 
 > configure;make -j2;make install.
 > 
 > Test:
 > lua test.lua | ../cdb -c c.cdb
 > cdb: (stdin): bad format
 > 
 > I give up and will
 use a temporary file for tinycdb.
 > 
 > Thank you all for your help.
 
 Do you have a sample file we
 could use to reproduce the issue? If the
 output of test.lua is not private data, just
 lua test.lua > sample.txt
 and mailing
 sample.txt to the list would suffice.
 
 Rich
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31 17:31 ` Guided Muscle
@ 2015-12-31 18:33   ` Rich Felker
  2015-12-31 20:34   ` Szabolcs Nagy
  1 sibling, 0 replies; 19+ messages in thread
From: Rich Felker @ 2015-12-31 18:33 UTC (permalink / raw)
  To: musl

On Thu, Dec 31, 2015 at 05:31:02PM +0000, Guided Muscle wrote:
> Recompiled and installed musl 1.1.12 freshly downloaded from the musl web site.
> configure;make -j2;make install.
> 
> Oops - just read the INSTALL file in the musl 1.1.12 directory. I'm using gcc 4.90.
> Installed gcc 4.8; recompiled musl 1.1.12; 
> configure;make -j2;make install.
> 
> Test:
> lua test.lua | ../cdb -c c.cdb
> cdb: (stdin): bad format
> 
> I give up and will use a temporary file for tinycdb.
> 
> Thank you all for your help.

Do you have a sample file we could use to reproduce the issue? If the
output of test.lua is not private data, just lua test.lua > sample.txt
and mailing sample.txt to the list would suffice.

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <1315337459.141890.1451583062461.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 17:31 ` Guided Muscle
  2015-12-31 18:33   ` Rich Felker
  2015-12-31 20:34   ` Szabolcs Nagy
  0 siblings, 2 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 17:31 UTC (permalink / raw)
  To: musl

Recompiled and installed musl 1.1.12 freshly downloaded from the musl web site.
configure;make -j2;make install.

Oops - just read the INSTALL file in the musl 1.1.12 directory. I'm using gcc 4.90.
Installed gcc 4.8; recompiled musl 1.1.12; 
configure;make -j2;make install.

Test:
lua test.lua | ../cdb -c c.cdb
cdb: (stdin): bad format

I give up and will use a temporary file for tinycdb.

Thank you all for your help.
--
GM

--------------------------------------------
On Thu, 12/31/15, Szabolcs Nagy <nsz@port70.net> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 7:10 AM
 
 * Guided Muscle <atguarded-gizmo@yahoo.com>
 [2015-12-30 20:04:41 +0000]:
 > I used musl-gcc to compile tinycdb on Debian 8 and kept
 getting errors on a very simple test case.
 > 
 
 are you using musl-gcc packaged by debian?
 that's very old and buggy
 
 you never said the musl version you are using..
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <1535596338.4389758.1451579882141.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31 16:38 ` Guided Muscle
  0 siblings, 0 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-31 16:38 UTC (permalink / raw)
  To: musl

Yes, I am using the Debian packaged musl-gcc.
I could compile musl 1.1.12, install the new version and report back to the list.

BTW, I wanted to add musl-gcc version the the report but musl-gcc --version does not tell me much on debian:(
How do I get musl-gcc version?
Thanks!
GM

--------------------------------------------
On Thu, 12/31/15, Szabolcs Nagy <nsz@port70.net> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Thursday, December 31, 2015, 7:10 AM
 
 * Guided Muscle <atguarded-gizmo@yahoo.com>
 [2015-12-30 20:04:41 +0000]:
 > I used musl-gcc to compile tinycdb on Debian 8 and kept
 getting errors on a very simple test case.
 > 
 
 are you using musl-gcc packaged by debian?
 that's very old and buggy
 
 you never said the musl version you are using..
 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-30 20:04 ` Guided Muscle
  2015-12-30 21:28   ` Szabolcs Nagy
@ 2015-12-31 12:10   ` Szabolcs Nagy
  1 sibling, 0 replies; 19+ messages in thread
From: Szabolcs Nagy @ 2015-12-31 12:10 UTC (permalink / raw)
  To: musl

* Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-30 20:04:41 +0000]:
> I used musl-gcc to compile tinycdb on Debian 8 and kept getting errors on a very simple test case.
> 

are you using musl-gcc packaged by debian?
that's very old and buggy

you never said the musl version you are using..


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31 11:42   ` Szabolcs Nagy
@ 2015-12-31 11:53     ` Szabolcs Nagy
  0 siblings, 0 replies; 19+ messages in thread
From: Szabolcs Nagy @ 2015-12-31 11:53 UTC (permalink / raw)
  To: musl

* Szabolcs Nagy <nsz@port70.net> [2015-12-31 12:42:58 +0100]:

> * Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-31 06:36:35 +0000]:
> > readv(0, [{"", 0}, {"+7,20957:key5238->value523852385"..., 1024}], 2) = 1024
> > readv(0, [{"23852385238523852385238523852385"..., 19950}, {"23852385238523852385238523852385"..., 1024}], 2) = 19952
> > writev(2, [{"cdb: (stdin): bad format\n", 25}, {NULL, 0}], 2) = 25
> 
> 
> cdb reads 1024+19952 = 20976 bytes
> which is a 18 byte header + 20957 byte value = 20975 bytes
> 
> so it did not read enough to determine that the format is wrong
> but it stopped parsing
> 

err, it did read enough, but most likely
the last byte should be a \n and it got
lost (probably because of null termination)

anyway, you have to look at the code to
figure out how the last byte might be
handled incorrectly.

> so it does not do the input buffering correctly
> 
> you need to check the code how it parses the input,
> if it uses libc functions (e.g. getline) then it might
> be a musl bug otherwise it's just a cdb bug.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31  6:36 ` Guided Muscle
@ 2015-12-31 11:42   ` Szabolcs Nagy
  2015-12-31 11:53     ` Szabolcs Nagy
  0 siblings, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2015-12-31 11:42 UTC (permalink / raw)
  To: musl

* Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-31 06:36:35 +0000]:
> readv(0, [{"", 0}, {"+7,20957:key5238->value523852385"..., 1024}], 2) = 1024
> readv(0, [{"23852385238523852385238523852385"..., 19950}, {"23852385238523852385238523852385"..., 1024}], 2) = 19952
> writev(2, [{"cdb: (stdin): bad format\n", 25}, {NULL, 0}], 2) = 25


cdb reads 1024+19952 = 20976 bytes
which is a 18 byte header + 20957 byte value = 20975 bytes

so it did not read enough to determine that the format is wrong
but it stopped parsing

so it does not do the input buffering correctly

you need to check the code how it parses the input,
if it uses libc functions (e.g. getline) then it might
be a musl bug otherwise it's just a cdb bug.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
       [not found] <1295998941.4272196.1451543795605.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-31  6:36 ` Guided Muscle
  2015-12-31 11:42   ` Szabolcs Nagy
  0 siblings, 1 reply; 19+ messages in thread
From: Guided Muscle @ 2015-12-31  6:36 UTC (permalink / raw)
  To: musl

Thanks all.
I have the strace outputs for the two ends of the pipe. However, I don;t know what to do with the files. What are the essential parts that I should email to this fine group?

BTW, the files are rather large.
Thank you.
--
GM

===== tail lua_strace.txt ==
write(1, "23752375237523752375237523752375"..., 15360) = 15360
write(1, "23752375237523752375237523752375"..., 492) = 492
write(1, "+7,20957:key5238->value523852385"..., 5120) = 5120
write(1, "23852385238523852385238523852385"..., 15360) = 15360
write(1, "23852385238523852385238523852385"..., 496) = 496
write(1, "+7,20961:key5239->value523952395"..., 5120) = 5120
write(1, "23952395239523952395239523952395"..., 15360) = 15360
write(1, "23952395239523952395239523952395"..., 500) = -1 EPIPE (Broken pipe)
--- stopped by SIGPIPE ---
+++ killed by SIGPIPE +++

===== tail cdb_strace.txt ==
write(3, "36523652365236523652365236523652"..., 16384) = 16384
readv(0, [{"", 0}, {"+7,20953:key5237->value523752375"..., 1024}], 2) = 1024
readv(0, [{"23752375237523752375237523752375"..., 19946}, {"7\n,20953:key5237->value523752375"..., 1024}], 2) = 19948
write(3, "36523652365236523652365236523652"..., 4096) = 4096
write(3, "37523752375237523752375237523752"..., 16384) = 16384
readv(0, [{"", 0}, {"+7,20957:key5238->value523852385"..., 1024}], 2) = 1024
readv(0, [{"23852385238523852385238523852385"..., 19950}, {"23852385238523852385238523852385"..., 1024}], 2) = 19952
writev(2, [{"cdb: (stdin): bad format\n", 25}, {NULL, 0}], 2) = 25
exit_group(2)                           = ?
+++ exited with 2 +++
==
--------------------------------------------
On Wed, 12/30/15, Rich Felker <dalias@libc.org> wrote:

 Subject: Re: [musl] Musl bug, or, am I losing my mind?
 To: musl@lists.openwall.com
 Date: Wednesday, December 30, 2015, 11:07 PM
 
 On Thu, Dec 31, 2015 at
 04:10:02AM +0100, Szabolcs Nagy wrote:
 >
 * Szabolcs Nagy <nsz@port70.net>
 [2015-12-30 22:28:33 +0100]:
 > > *
 Guided Muscle <atguarded-gizmo@yahoo.com>
 [2015-12-30 20:04:41 +0000]:
 > > >
 cat o.txt | cdb -c c.cdb  
 > > >
 FAILED: cdb: (stdin): bad format
 > >
 > 
 > > > However 
 > > > PASS: cdb -c c.cdb < o.txt
 > > 
 > > my guess
 is that cdb does not handle short reads properly
 > > 
 > > but you
 can see what's going on with strace
 >
 
 > another guess: if this is a musl based
 system
 > then there was a gcc bug that
 broke fflush at
 > exit so cat would
 truncate the output.
 > 
 > again strace can tell if that is the
 case.
 
 "On Debian
 8" is probably not a musl-based cat.
 
 Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-31  3:10     ` Szabolcs Nagy
@ 2015-12-31  4:07       ` Rich Felker
  0 siblings, 0 replies; 19+ messages in thread
From: Rich Felker @ 2015-12-31  4:07 UTC (permalink / raw)
  To: musl

On Thu, Dec 31, 2015 at 04:10:02AM +0100, Szabolcs Nagy wrote:
> * Szabolcs Nagy <nsz@port70.net> [2015-12-30 22:28:33 +0100]:
> > * Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-30 20:04:41 +0000]:
> > > cat o.txt | cdb -c c.cdb  
> > > FAILED: cdb: (stdin): bad format
> > > 
> > > However 
> > > PASS: cdb -c c.cdb < o.txt
> > 
> > my guess is that cdb does not handle short reads properly
> > 
> > but you can see what's going on with strace
> 
> another guess: if this is a musl based system
> then there was a gcc bug that broke fflush at
> exit so cat would truncate the output.
> 
> again strace can tell if that is the case.

"On Debian 8" is probably not a musl-based cat.

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-30 21:28   ` Szabolcs Nagy
@ 2015-12-31  3:10     ` Szabolcs Nagy
  2015-12-31  4:07       ` Rich Felker
  0 siblings, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2015-12-31  3:10 UTC (permalink / raw)
  To: musl

* Szabolcs Nagy <nsz@port70.net> [2015-12-30 22:28:33 +0100]:
> * Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-30 20:04:41 +0000]:
> > cat o.txt | cdb -c c.cdb  
> > FAILED: cdb: (stdin): bad format
> > 
> > However 
> > PASS: cdb -c c.cdb < o.txt
> 
> my guess is that cdb does not handle short reads properly
> 
> but you can see what's going on with strace

another guess: if this is a musl based system
then there was a gcc bug that broke fflush at
exit so cat would truncate the output.

again strace can tell if that is the case.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Musl bug, or, am I losing my mind?
  2015-12-30 20:04 ` Guided Muscle
@ 2015-12-30 21:28   ` Szabolcs Nagy
  2015-12-31  3:10     ` Szabolcs Nagy
  2015-12-31 12:10   ` Szabolcs Nagy
  1 sibling, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2015-12-30 21:28 UTC (permalink / raw)
  To: musl

* Guided Muscle <atguarded-gizmo@yahoo.com> [2015-12-30 20:04:41 +0000]:
> Make options:
> CC=musl-gcc
> CFLAGS=-O2 -s -static -fPIC -D_FILE_OFFSET_BITS=64 

-D_FILE_OFFSET_BITS=64 is noop on musl
-fPIC is not useful if you static link
(if you want position independent executable then use -fPIE)

> cat o.txt | cdb -c c.cdb  
> FAILED: cdb: (stdin): bad format
> 
> However 
> PASS: cdb -c c.cdb < o.txt

my guess is that cdb does not handle short reads properly

but you can see what's going on with strace


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Musl bug, or, am I losing my mind?
       [not found] <1337210970.4152546.1451505881575.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2015-12-30 20:04 ` Guided Muscle
  2015-12-30 21:28   ` Szabolcs Nagy
  2015-12-31 12:10   ` Szabolcs Nagy
  0 siblings, 2 replies; 19+ messages in thread
From: Guided Muscle @ 2015-12-30 20:04 UTC (permalink / raw)
  To: musl

Houston, I think we have a problem.
I used musl-gcc to compile tinycdb on Debian 8 and kept getting errors on a very simple test case.

Make options:
CC=musl-gcc
CFLAGS=-O2 -s -static -fPIC -D_FILE_OFFSET_BITS=64 
The resulting executable is cdb.

Test data is generated via a lua script (test.lua):
for i=1,10000 do
  key,val="key" .. tostring(i), "value" .. string.rep(tostring(i),i)
  print(string.format("+%d,%d:%s->%s", string.len(key),string.len(val),key,val))
end
print("\n")

Running lua test.lua | cdb -c o.cdb always results in an error ... FAILED
cdb: (stdin): bad format

So, maybe they broke the pipe in Linux Debian ... Let's prepare a temporary file  lua test.lua > o.txt

The, run this puppy:
cat o.txt | cdb -c c.cdb  
FAILED: cdb: (stdin): bad format

However 
PASS: cdb -c c.cdb < o.txt

What am I missing?

Thanks
GM


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-12-31 20:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2021478498.4444333.1451595055186.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 20:50 ` Musl bug, or, am I losing my mind? Guided Muscle
     [not found] <1229082331.4470232.1451594892445.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 20:48 ` Guided Muscle
     [not found] <786818513.4541881.1451591973977.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 19:59 ` Guided Muscle
     [not found] <2036560950.4461281.1451590538227.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 19:35 ` Guided Muscle
2015-12-31 19:45   ` Rich Felker
     [not found] <1163254146.4344492.1451589596849.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 19:19 ` Guided Muscle
     [not found] <1315337459.141890.1451583062461.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 17:31 ` Guided Muscle
2015-12-31 18:33   ` Rich Felker
2015-12-31 20:34   ` Szabolcs Nagy
2015-12-31 20:35     ` Rich Felker
     [not found] <1535596338.4389758.1451579882141.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31 16:38 ` Guided Muscle
     [not found] <1295998941.4272196.1451543795605.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-31  6:36 ` Guided Muscle
2015-12-31 11:42   ` Szabolcs Nagy
2015-12-31 11:53     ` Szabolcs Nagy
     [not found] <1337210970.4152546.1451505881575.JavaMail.yahoo.ref@mail.yahoo.com>
2015-12-30 20:04 ` Guided Muscle
2015-12-30 21:28   ` Szabolcs Nagy
2015-12-31  3:10     ` Szabolcs Nagy
2015-12-31  4:07       ` Rich Felker
2015-12-31 12:10   ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).