New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tar can fail due to incorrect error code for missing directory #12
Comments
Do you have a practical example of when Indeed you're right, the error code ENOTDIR looks inappropriate in this context, but I'm curious why I've never experienced any problem. |
I'm using tar-1.12 to extract a few directories of linux source code:
Changing that return code makes it work. By the way, I should mention that I've been able to run live-bootstrap using the Fiwix kernel. It starts from a tiny hex compiler and tons of source code and build up through several dozen packages all the way up to building the linux kernel. However, that took about 28 significant changes to Fiwix including 13 new syscalls. I'll be working to submit those changes to you, although some of them may be specific to live-bootstrap so we'll have to see whether it makes sense for you to accept them. I can maintain a fork if necessary but I'd rather not. |
Ok, I think I've got a simple way to reproduce the problem:
|
That's really amazing. I'm very glad to know Fiwix is something useful for your project.
13 new syscalls? wow! that's a lot. How is that? Hmm, oriansj told me in the Fiwix channel at Libera.Chat that you are using Musl C library for your project. Why are you using that C library that is so dependent to the Linux kernel? Why are you not using something more open and standard like Newlib C? Perhaps with Newlib C you can do the same with less changes on Fiwix and also to other tools of the project. Don't get me wrong. I'm not contrary to add those 13 system calls. I hope with these new system calls I'll be able to port more software to FiwixOS. I'd like to have the list of them, just to make me an idea.
Yup, I can easily reproduce the problem. |
I don't know about musl vs Newlib C. To be honest, I've never heard of Newlib C. Those decisions were made long before I joined to work on the kernel bootstrapping. Musl did seem a bit complex but it supports a lot of functionality. I'll have to ask on the the chat. BTW, you'd be very welcome on the chat. There are a lot of folks following the Fiwix work. The new syscalls were stat64, lstat64, fstat64, readv, writev, mmap2, chown32, madvise (stub), getdents64, fcntl64, utimes, pipe2, and ftruncate. |
I'll be glad to join to the channel and help on questions about Fiwix.
I'm a bit concerned on the xxxx64 system calls if they break the code to be run under i386 processors. Besides this, it's strange you can't build software without these system calls. Normally I mean, I've been able to port very recent software to FiwixOS without theses system calls. I've seen some of these system calls failing in the Anyway, the Fiwix kernel tries to keep compatibility with the old Linux 2.0. These system calls come from Linux 2.4, Linux 2.6, or even more. If you are interested to include them, I think it could be interesting to isolate them with a configure option. Something like: |
I can certainly make config options. Even though these calls may have 64-bit data, to support very large files for example, all of these system calls are defined for x86 / 32-bit Linux, although many are indeed introduced in newer versions. I'm using this reference: They shouldn't cause any problems with i386 processors. I've run the builds with qemu-system-i386 with no problems. I can take a closer look at whether musl configuration will allow avoiding some of these syscalls but I've looked before and there was no obvious way to do it. Musl is multi-architecture and we're already configuring with --host=i386. It may not have that kind of granularity around syscalls. I'll submit a PR for the ENOENT fix soon after I take care of some other things. |
Hey @mikaku, live-bootstrap developer here :) Just wanted to note why we are using musl for live-bootstrap as opposed to something like newlib (I haven't actually heard of newlib before, but I'm not sure if it really has all these benefits). Originally while we were waiting for a kernel bootstrap I was targeting Linux 2.6+.
Specifically for newlib it uses autogen and autotools which are incredibly difficult to work around due to their complexity. We would have to handwrite a Makefile for it which is rather tedious work. This largely means that we encounter significantly less resistance when building random utilities than we would if we used a lesser known alternative libc (newlib, uclibc, for eg). I see FiwixOS uses newlib, so there is a chance a good amount of software in live-bootstrap would work with newlib, but I don't see significant gain by choosing newlib, apart from libc complexity (some of which we actually rely on regardless). Thank you very much for your work on Fiwix. From when I first saw it, and this has been re-iterated as it has been moved, Fiwix's simplicity and conformity to older standards is incredibly helpful to providing a rather pain-free kernel bootstrap. |
Keep in mind that for QEMU and more systems the x86 architecture starts on the Pentium, and hence it will accept new i486 and i586 processor instructions that an i386 don't has. I'm running QEMU with the option
No, don't waste your time on it.
Yes, please. Regarding musl and Newlib debate, I see you firmly convinced and comfortable with musl. I don't want to change your mind. If you ever feel curious with Newlib, you have FiwixOS. All software there has been compiled using the toolchain GCC+binutils+Newlib on the system.
I really appreciate your words. Thank you very much. |
Extracting a tar file can fail on Fiwix because tar expects ENOENT for missing intermediate directories but it is getting ENOTDIR instead.
The relevant source code for tar:
https://git.savannah.gnu.org/cgit/tar.git/tree/src/extract.c#n883
This code should return -ENOENT:
Fiwix/fs/namei.c
Lines 129 to 131 in 6e036aa
ENOTDIR is the error code for trying to do something to a directory that is not a directory.
The text was updated successfully, but these errors were encountered: