From: "piranna@gmail.com" <piranna@gmail.com>
To: musl@lists.openwall.com
Subject: Bug on fstat()?
Date: Sun, 24 Aug 2014 22:51:09 +0200 [thread overview]
Message-ID: <CAKfGGh12wz1QMPcdLiQuGaCyuyt57hV2nsY9TAJ8A=D76a7ZYA@mail.gmail.com> (raw)
I have been able to compile Node.js using musl to create a fully
statically linked executable (SSL disabled, OpenSSL was giving too
much problems...), and although Node.js REPL works, it can't be able
to load script files.
Digging on the code I have got to the point that Node.js do a fstat()
call to know the size of the script file so it can fill a buffer of
the correct size, problem is that fstat() is giving me some crazy
values. I did the same before using glibc and it was able to load
simple script files, so seems to be a problem related to musl (or the
environment I've crafted to be able to compile Node.js using musl).
The simple test file is:
#!./node
while(true)
{
console.log('Hello NodeOS! :-)')
};
./node is the musl-compiled static Node.js executable. Executing this
file from console give me the next error, the same error is thrown by
dispatching it as parameter of the Node.js executable:
fs.js:505
var r = binding.read(fd, buffer, offset, length, position);
^
Error: Offset is out of bounds
at Error (native)
at Object.fs.readSync (fs.js:505:19)
at Object.fs.readFileSync (fs.js:346:28)
at Object.Module._extensions..js (module.js:477:20)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:124:16)
at node.js:811:3
The values that fstat() is returning are:
{ dev: 2051,
mode: 33261,
nlink: 1,
uid: 1000,
gid: 1000,
rdev: 0,
blksize: 8,
ino: 584753551390482400,
size: 17592186044477,
blocks: 1485010404567043000,
atime: Sun Aug 24 2014 22:33:06 GMT+0200 (CEST),
mtime: Sun Aug 24 2014 22:33:06 GMT+0200 (CEST),
ctime: Thu Jan 01 1970 01:00:00 GMT+0100 (CET),
birthtime: Thu Jan 01 1970 01:00:00 GMT+0100 (CET) }
As you can see, is giving a size of 164GBs for a file of just 68
characters :-) ino, blocks and blksize have some strange values too,
but the other fields seems to be normal. As I told you, fstat() give a
correct output while compiling Node.js with glibc.
I'm using musl with the musl-gcc wrapper, and since it was giving me
problems related to some includes not available, I've done some (not
very clean, I know) symbolic links to them:
sudo ln -s /usr/include/linux
/usr/include/i386-linux-musl/linux
sudo ln -s /usr/include/i386-linux-gnu/asm /usr/include/i386-linux-musl/asm
sudo ln -s /usr/include/asm-generic
/usr/include/i386-linux-musl/asm-generic
Any advice about what could be happening? How could I be able to solve it?
--
"Si quieres viajar alrededor del mundo y ser invitado a hablar en un
monton de sitios diferentes, simplemente escribe un sistema operativo
Unix."
– Linus Tordvals, creador del sistema operativo Linux
next reply other threads:[~2014-08-24 20:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-24 20:51 piranna [this message]
2014-08-24 21:05 ` Rich Felker
2014-08-24 21:23 ` piranna
2014-08-24 21:35 ` Luca Barbato
2014-08-25 9:18 ` piranna
2014-08-25 9:31 ` piranna
2014-08-25 9:49 ` Szabolcs Nagy
2014-08-25 15:48 ` Rich Felker
2014-08-26 19:05 ` piranna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKfGGh12wz1QMPcdLiQuGaCyuyt57hV2nsY9TAJ8A=D76a7ZYA@mail.gmail.com' \
--to=piranna@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).