Re: [Toybox] Patches for toybox-0.4.8
On 06/23/14 10:35, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-which-sigsegv.patch First patch also contains fixes of toy.h for musl c library. I hope that I help you. I have a todo note that I should do a better job following up on this: Did the commits we merged resolve all your issues, are is there still anything pending? Thanks, Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
On 06/23/14 10:35, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-which-sigsegv.patch First patch also contains fixes of toy.h for musl c library. I hope that I help you. Do the fixes that went in for these address your issues? (Commit 1360 should fix the which segfault, and 1361 should fix the musl build break in getty.) Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
On 06/23/14 16:45, Isaac Dunham wrote: On Mon, Jun 23, 2014 at 05:35:55PM +0200, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch This is not correct; a system where ngroups ! 0 is broken, and id *should* perror_exit(). Make sure you have something in /etc/group and /etc/passwd. What exactly broke without sys/ttydefaults.h? I've built defconfig against musl, so... something under pending? (Or something in a very recent musl version?) https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-which-sigsegv.patch Looks good. Hmmm, find_in_path() is supposed to be able to accept a NULL... struct string_list *find_in_path(char *path, char *filename) { struct string_list *rlist = NULL, **prlist=rlist; char *cwd = xgetcwd(); for (;;) { char *next = path ? strchr(path, ':') : NULL; See, testing for NULL right there... int len = next ? next-path : strlen(path); But strlen() is going to segfault. Sigh. Committed a fix. First patch also contains fixes of toy.h for musl c library. ie, +#include sys/ttydefaults.h I've had no recent issues building toybox on my system, based on musl. What did you hit? (I'm guessing top, telnet, or watch under toys/pending/ ?) Also, sys/ttydefaults.h is not a POSIX header; it does not go into toys.h. If it's needed, it goes into the toy where it's needed. Or it could go in lib/portability.h under an #ifdef musl since that seems to e the only thing that needs it. I'd have to work out what the appropriate #ifdef would be, but I'm sure I can come up with something. :) Anyhow: You probably should add mkpasswd, which encrypts passwords. A minimal /etc/group (group:cryptpasswd:gid:users) root:x:0:root where x means the group password isn't here, and users is a comma-separated list of all users in the group. And /etc/passwd: root:x:0:0:root:/root:/bin/sh where the fields are as follows: username password (encrypted, or x to indicate that it's in /etc/shadow) uid gid full user name $HOME shell And building /etc/shadow: #!/bin/sh printf root password: read password echo root:`mkpasswd -m sha512 $password`:$((365*44)):0:9:7::: \ $DESTDIR/etc/shadow Where 365*44 is the number of days from Jan 1 1970 to when you set the password; 9 is the number of days from when you set the password till it expires; and 7 is the number of days from expiration that you have a chance to login and change your password. Forcing password expiration in an embedded system does not help matters. I need to do more cleanup there... Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
W dniu 24.06.2014 15:20, Rob Landley pisze: On 06/23/14 16:45, Isaac Dunham wrote: On Mon, Jun 23, 2014 at 05:35:55PM +0200, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch This is not correct; a system where ngroups ! 0 is broken, and id *should* perror_exit(). Make sure you have something in /etc/group and /etc/passwd. What exactly broke without sys/ttydefaults.h? I've built defconfig against musl, so... something under pending? (Or something in a very recent musl version?) getty.c requires sys/ttydefaults.h. Error of my compilation: toys/pending/getty.c:168:29: error: 'CERASE' undeclared (first use in this function) The CERASE macro and more similar macros just are defined at sys/ttydefaults.h in musl libc. This header file isn't included any header file in musl libc. I use musl-1.0.3. ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
W dniu 23.06.2014 23:45, Isaac Dunham pisze: On Mon, Jun 23, 2014 at 05:35:55PM +0200, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch This is not correct; a system where ngroups ! 0 is broken, and id *should* perror_exit(). Make sure you have something in /etc/group and /etc/passwd. But if (0 = ngroups) also isn't correct because getgrouplist returns -1 for error but doesn't return 0. There should be if (0 ngroups) instead of if (0 = ngroups). Maybe I could changed it at my patch but I wasn't sure reaction of the id toy. ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
luck...@vp.pl wrote: [..] getty.c requires sys/ttydefaults.h. Error of my compilation: toys/pending/getty.c:168:29: error: 'CERASE' undeclared (first use in this function) The CERASE macro and more similar macros just are defined at sys/ttydefaults.h in musl libc. This header file isn't included any header file in musl libc. I use musl-1.0.3. For that one constant it might be simpler to replace its only occurence by 0177 or 127 and leave a comment that that's CERASE. Felix ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
On Tue, Jun 24, 2014 at 04:54:57PM +0200, luck...@vp.pl wrote: W dniu 23.06.2014 23:45, Isaac Dunham pisze: On Mon, Jun 23, 2014 at 05:35:55PM +0200, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch This is not correct; a system where ngroups ! 0 is broken, and id *should* perror_exit(). Make sure you have something in /etc/group and /etc/passwd. But if (0 = ngroups) also isn't correct because getgrouplist returns -1 for error but doesn't return 0. There should be if (0 ngroups) instead of if (0 = ngroups). Maybe I could changed it at my patch but I wasn't sure reaction of the id toy. On any sane *nix system, every user will be a member of at least one group. HTH, Isaac Dunham ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] Patches for toybox-0.4.8
On 06/24/14 16:20, Isaac Dunham wrote: On Tue, Jun 24, 2014 at 04:54:57PM +0200, luck...@vp.pl wrote: W dniu 23.06.2014 23:45, Isaac Dunham pisze: On Mon, Jun 23, 2014 at 05:35:55PM +0200, luck...@vp.pl wrote: I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch This is not correct; a system where ngroups ! 0 is broken, and id *should* perror_exit(). Make sure you have something in /etc/group and /etc/passwd. But if (0 = ngroups) also isn't correct because getgrouplist returns -1 for error but doesn't return 0. There should be if (0 ngroups) instead of if (0 = ngroups). Maybe I could changed it at my patch but I wasn't sure reaction of the id toy. On any sane *nix system, every user will be a member of at least one group. Actually I'm starting to lean towards luckboy's point of view on this one. If we have user information but not group information, we can show what we've got. That said, it would be really nice of http://pubs.opengroup.org/onlinepubs/9699919799/utilities/id.html was of ANY USE in this situation. Sigh... Ok, in the stdout section it says: uid=%u(%s) gid=%u(%s)\n, real user ID, user-name, real group ID, group-name I.E. at least one gid is not optional, according to posix? That said, it's not guaranteed to be _there_. /etc/passwd has a gid field but nobody said /etc/groups has that entry. Sigh. My first quick stab at it looks like: --- a/toys/posix/id.c Tue Jun 24 21:47:07 2014 -0500 +++ b/toys/posix/id.c Tue Jun 24 23:37:42 2014 -0500 @@ -113,14 +113,13 @@ i = sizeof(toybuf)/sizeof(gid_t); ngroups = username ? getgrouplist(username, gid, groups, i) : getgroups(i, groups); - if (0 = ngroups) perror_exit(0); + if (ngroups0) perror_exit(0); - for (i = 0;;) { + for (i = 0; ingroups; i++) { +if (i) xputc(' '); if (!(grp = getgrgid(groups[i]))) perror_msg(0); else if (flags FLAG_G) s_or_u(grp-gr_name, grp-gr_gid, 0); else if (grp-gr_gid != egid) showid(, grp-gr_gid, grp-gr_name); -if (++i = ngroups) break; -xputc(' '); } xputc('\n'); } The space at the beginning is wrong because if you don't feed in flag -G it prints the initial group= before the loop, except that called xgetgrid() which will error_exit() if it can't return one, and if it _did_ return a null pointer the later users would segfault... Sigh. Waaay past my bedtime... Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
[Toybox] Patches for toybox-0.4.8
I created own build system for small linux distributions. I had to write two patches for your toybox-0.4.8. First patch fixes display of the id toy. Second patch fixes sigsegv of the which toy for the unset PATH variable of environment. These patches: https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-fixes.patch https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.8-which-sigsegv.patch First patch also contains fixes of toy.h for musl c library. I hope that I help you. ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net