Re: [Toybox] macOS sitrep

2018-12-07 Thread Rob Landley



On 12/7/18 8:28 PM, enh wrote:
> On Tue, Dec 4, 2018 at 8:05 PM Rob Landley  wrote:
>>
>> On 12/4/18 7:06 PM, enh wrote:
>>> okay, so now toybox builds out of the box (with a custom .config) i
>>> added a bunch more stuff to my .config. the following were all
>>> painless:
>>>
>>> ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
>>> comm count cpio crc32 cut dirname dos2unix du echo egrep env expand
>>> factor false fgrep file flock fmt ftpget ftpput grep groups head help
>>> hexedit hostname iconv id kill killall5 link ln logname md5sum microcom
>>> mkdir mkfifo mktemp nc netcat nice nl nohup od paste patch printenv
>>> printf pwd pwdx readlink realpath renice rev rm rmdir sed seq setsid
>>> sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort split strings
>>> tac tee timeout true truncate tty uname uniq unix2dos unlink usleep
>>> uudecode uuencode uuidgen w watch wc which who whoami xargs xxd yes
>>
>> Could you send me your .config? I can check in a "make macos_defconfig".
> 
> with the two extra patches i just sent to the list, you can build a
> whole bunch of stuff:

Applied.

> ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
> comm count cpio crc32 cut date dirname dos2unix du echo egrep env
> expand factor false fgrep file find flock fmt ftpget ftpput getconf
> grep groups head help hexedit hostname iconv id kill killall5 link
> ln logger logname ls md5sum microcom mkdir mkfifo nc netcat nice nl
> nohup od paste patch printenv printf pwd pwdx readlink realpath renice
> rev rm rmdir sed seq setsid sha1sum sha224sum sha256sum sha384sum
> sha512sum sleep sort split strings tac tee time timeout touch tr true
> truncate tty uname uniq unix2dos unlink usleep uudecode uuencode uuidgen
> w watch wc which who whoami xargs xxd yes

Which means it's _not_ building (rummage rummage)

acpi blkid blockdev bunzip2 bzcat chattr chroot chrt chvt cp df dmesg eject
fallocate free freeramdisk fsfreeze fstype fsync halt hwclock i2cdetect i2cdump
i2cget i2cset ifconfig inotifyd insmod install ionice iorenice iotop killall
login losetup lsattr lsmod lspci lsusb makedevs mix mknod mkpasswd mkswap mktemp
modinfo mount mountpoint mv nbd-client netstat nproc oneit partprobe passwd
pgrep pidof ping ping6 pivot_root pkill pmap poweroff prlimit ps readahead
reboot reset rfkill rmmod setfattr shred stat su swapoff swapon switch_root sync
sysctl tail taskset test top tunctl ulimit umount uptime vconfig vmstat


Hmmm... bunzip2 and bzcat are easy, reset, sync, mktemp, and test might already
work, shred is trivial but silly on journaled filesystems (it was a request),
dunno how much work stat is, tail has two codepaths and one's probably easy...

The cp/install/mktemp/mv cluser... dunno what's missing? IN theory the openat()
stuff is posix-2008?

ps/top/iotop/pkill/pgrep are probably a nightmare because of the /proc stuff and
I have no idea what a macos equivalent would look like.

Most of the rest probably doesn't apply conceptually. (I mean... maybe
blkid? Dunno what macos does for mount...)

> i've basically ignored pending for now, because i was only originally
> hoping to answer the question "is this feasible?" and i think we have
> a pretty strong "yes" that includes most of the things we'd need for a
> mac AOSP build already.

Cool.

> i might try to get the xattr portability wrapper done before i have to
> give the mac back, but otherwise i'm hanging the "mission
> accomplished" banner for now and will worry about actually, you know,
> _using_ this stuff some other day. probably after i've finished
> getting linux AOSP builds switched over, which is much more
> interesting to me anyway (and especially in the short term).

I wonder how horrible building this subset under https://midipix.org and/or the
Windows linux binary running thingy interface is?

> i've attached my config. note that i've included TODOs explaining why
> a few of the main failures don't build. tail's inotify is
> interesting/annoying.

It's all for FLAG_f. I could add a compile-time probe with a config symbol and a
portability.h stub? (Or move the sys/inotify.h #include into portability.h so
#ifdef APPLE could #else it...)

>>> (i haven't even bothered trying anything from pending.)
>>
>> If you get the urge for specific commands out of there, lemme know. I just
>> finished redoing test.c and I'm squinting at tftpd.c now (using a dhcp/bootp
>> thing at $DAYJOB)...
> 
> of the stuff in pending, AOSP builds would use dd, diff, egrep, grep,
> tar, and tr.

grep isn't in pending, but I need to add --color support.

> all of which were on your "non-trivial" list. (we're
> _building_ toybox's grep family, but we're still using the BSD ones.
> Q/master is currently using toybox dd [P had BSD dd].)

Lemme see what I can get done on grep --color this weekend...

The macos regex() implementation is still a bit different from any of the
linuxes, might still cause a problem there...

Rob
__

Re: [Toybox] macOS sitrep

2018-12-07 Thread enh via Toybox
On Tue, Dec 4, 2018 at 8:05 PM Rob Landley  wrote:
>
> On 12/4/18 7:06 PM, enh wrote:
> > okay, so now toybox builds out of the box (with a custom .config) i
> > added a bunch more stuff to my .config. the following were all
> > painless:
> >
> > ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
> > comm count cpio crc32 cut dirname dos2unix du echo egrep env expand
> > factor false fgrep file flock fmt ftpget ftpput grep groups head help
> > hexedit hostname iconv id kill killall5 link ln logname md5sum microcom
> > mkdir mkfifo mktemp nc netcat nice nl nohup od paste patch printenv
> > printf pwd pwdx readlink realpath renice rev rm rmdir sed seq setsid
> > sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort split strings
> > tac tee timeout true truncate tty uname uniq unix2dos unlink usleep
> > uudecode uuencode uuidgen w watch wc which who whoami xargs xxd yes
>
> Could you send me your .config? I can check in a "make macos_defconfig".

with the two extra patches i just sent to the list, you can build a
whole bunch of stuff:

ascii base64 basename cal cat catv chgrp chmod chown cksum clear cmp
comm count cpio crc32 cut date dirname dos2unix du echo egrep env
expand factor false fgrep file find flock fmt ftpget ftpput getconf
grep groups head help hexedit hostname iconv id kill killall5 link
ln logger logname ls md5sum microcom mkdir mkfifo nc netcat nice nl
nohup od paste patch printenv printf pwd pwdx readlink realpath renice
rev rm rmdir sed seq setsid sha1sum sha224sum sha256sum sha384sum
sha512sum sleep sort split strings tac tee time timeout touch tr true
truncate tty uname uniq unix2dos unlink usleep uudecode uuencode uuidgen
w watch wc which who whoami xargs xxd yes

i've basically ignored pending for now, because i was only originally
hoping to answer the question "is this feasible?" and i think we have
a pretty strong "yes" that includes most of the things we'd need for a
mac AOSP build already.

i might try to get the xattr portability wrapper done before i have to
give the mac back, but otherwise i'm hanging the "mission
accomplished" banner for now and will worry about actually, you know,
_using_ this stuff some other day. probably after i've finished
getting linux AOSP builds switched over, which is much more
interesting to me anyway (and especially in the short term).

i've attached my config. note that i've included TODOs explaining why
a few of the main failures don't build. tail's inotify is
interesting/annoying.

> > (i haven't even bothered trying anything from pending.)
>
> If you get the urge for specific commands out of there, lemme know. I just
> finished redoing test.c and I'm squinting at tftpd.c now (using a dhcp/bootp
> thing at $DAYJOB)...

of the stuff in pending, AOSP builds would use dd, diff, egrep, grep,
tar, and tr. all of which were on your "non-trivial" list. (we're
_building_ toybox's grep family, but we're still using the BSD ones.
Q/master is currently using toybox dd [P had BSD dd].)

> I'm aware android's building bc, dd, diff, expr, getfattr, gzip, lsof, 
> modprobe,
> more, stty, tar, tr, and traceroute. But most of that isn't low hanging fruit
> for cleanup. Although I'm close on the compression side of gzip, and since
> watch.c I think I know how to tackle less/more now (although I need to go 
> _back_
> to watch and add ansi color support, which I also need to do in grep although
> _that's_ a genericiation of the -o logic), and getfattr _would_ be low hanging
> fruit if I had any sort of test case for it (what files on ubuntu normally 
> have
> xattrs I can examine?) Last time I tried to tackle expr. I spent all the
> time/energy I had reading a chunk of that pdf on the precedence climbing thing
> and the window got buried and my machine eventually rebooted...
>
> Mostly when I look at pending it's ls -lS toys/pending, but vi.c is a stub,
> groupdel is part of the userdel/useradd/groupadd cluster, getfattr.c I haven't
> got any real test cases for (what on ubuntu has attributes I can look at?),
> ipcrm I've never really used (and it's in suite with ipcs, need to read up on
> both), and that brings us to fold which is basically "not fmt".
>
> Chipping away at it as I can...
>
> Rob


config
Description: Binary data
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


[Toybox] [PATCH] macOS: fix getconf(1) build.

2018-12-07 Thread enh via Toybox
Several parameters common on Linux are missing on macOS.
---
 toys/posix/getconf.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/toys/posix/getconf.c b/toys/posix/getconf.c
index 6e230efb..57c171dd 100644
--- a/toys/posix/getconf.c
+++ b/toys/posix/getconf.c
@@ -37,6 +37,20 @@ config GETCONF
 #define UIO_MAXIOV 1024
 #endif

+#ifdef __APPLE__
+// macOS doesn't have a bunch of stuff. The actual macOS getconf says
+// "no such parameter", but -- unless proven otherwise -- it seems more useful
+// for portability if we act like we understood but say "undefined"?
+#define _SC_AVPHYS_PAGES -1
+#define _SC_THREAD_ROBUST_PRIO_INHERIT -1
+#define _SC_THREAD_ROBUST_PRIO_PROTECT -1
+#define _SC_V7_ILP32_OFF32 -1
+#define _SC_V7_ILP32_OFFBIG -1
+#define _SC_V7_LP64_OFF64 -1
+#define _SC_V7_LPBIG_OFFBIG -1
+#define _CS_V7_ENV -1
+#endif
+
 struct config {
   char *name;
   long long value;
-- 
2.19.0.605.g01d371f741-goog


0001-macOS-fix-getconf-1-build.patch
Description: Binary data
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


[Toybox] [PATCH] macOS: fix code using POSIX 2008 `st_[acm]tim` fields.

2018-12-07 Thread enh via Toybox
Hopefully they'll fix this properly at some point, but until then...
---
 lib/portability.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/lib/portability.h b/lib/portability.h
index 21d0b8a1..ad7965ec 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -7,6 +7,17 @@
 // For musl
 #define _ALL_SOURCE

+#ifdef __APPLE__
+// macOS 10.13 doesn't have the POSIX 2008 direct access to timespec in
+// struct stat, but we can ask it to give us something equivalent...
+// (This must come before any #include!)
+#define _DARWIN_C_SOURCE
+// ...and then use macros to paper over the difference.
+#define st_atim st_atimespec
+#define st_ctim st_ctimespec
+#define st_mtim st_mtimespec
+#endif
+
 // Test for gcc (using compiler builtin #define)

 #ifdef __GNUC__
-- 
2.19.0.605.g01d371f741-goog


0001-macOS-fix-code-using-POSIX-2008-st_-acm-tim-fields.patch
Description: Binary data
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [PATCH] mktemp: yet more tests, and yet more fixes.

2018-12-07 Thread Rob Landley
On 12/7/18 4:05 PM, enh wrote:
> I didn't see this until just now (see "list mass unsubscribe again"), but 
> I'll
> try to take a proper look this weekend and see what I missed.
> 
> i think you missed an entire change? toybox ToT doesn't currently build. 
> mktemp
> assumes that xgetrandom returns bool and has a new WARN_ONLY flag, but
> xgetrandom is void and doesn't have a special case for both getrandom and /dev
> not being available...

Oops. Fixed.

Sorry about that.

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [PATCH] mktemp: yet more tests, and yet more fixes.

2018-12-07 Thread enh via Toybox
On Fri, Dec 7, 2018 at 7:41 AM Rob Landley  wrote:

> On 12/6/18 10:52 AM, enh via Toybox wrote:
> > We can't reuse the password.c code for random ASCII salts because that
> > allows '/' (plus it seems to generate sequences of trailing '.'s for
> > some reason). Do the simplest thing that could possibly work instead.
>
> I need a week sometime to properly put the user account management stuff
> into
> mkroot and get it all promoted.
>
> Part of the reason it's further down my todo list is it's no use to Android
> because PIDs mean something else there and login data would go in your
> version
> of the registry instead of being unix-style text files anyway...
>
> > ---
> >  tests/mktemp.test |  6 ++
> >  toys/lsb/mktemp.c | 34 --
> >  2 files changed, 34 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/mktemp.test b/tests/mktemp.test
> > index ee023d6b..0c235469 100755
> > --- a/tests/mktemp.test
> > +++ b/tests/mktemp.test
> > @@ -37,3 +37,9 @@ testing "-p DIR -t TEMPLATE but no TMPDIR" "TMPDIR=
> > mktemp -u -p DIR -t hello.XX
> >
> >  # mktemp -u doesn't need to be able to write to the directory.
> >  testing "-u" "mktemp -u -p /proc | grep -q '^/proc/tmp\...$'
> > && echo yes" "yes\n" "" ""
> > +
> > +# mktemp needs at least XX in the template.
> > +testing "bad template" "mktemp -u helloX || echo error" "error\n" "" ""
>
> The one on ubuntu 14.04 required three XXX, so that's what I checked for...
>

yeah, they seem to have relaxed that to just XX in newer versions, but i
don't think it matters.


> > +# mktemp -q shouldn't print the path.
> > +testing "-q" "mktemp -p /proc -q || echo only-failure" "only-failure\n"
> "" ""
> > diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c
> > index 57d1d118..55ab1aff 100644
> > --- a/toys/lsb/mktemp.c
> > +++ b/toys/lsb/mktemp.c
> > @@ -37,6 +37,8 @@ void mktemp_main(void)
> >int template_dir = template && !!strchr(template, '/');
> >int flags_dir = (toys.optflags & (FLAG_p|FLAG_t));
> >int use_dir = flags_dir && !template_dir;
> > +  char *s, *e;
> > +  int len;
> >
> >if (template_dir && flags_dir) error_exit("conflicting directories
> given");
> >
> > @@ -61,12 +63,32 @@ void mktemp_main(void)
> >// TODO: coreutils cleans paths, so -p /t/// would result in /t/xxx...
> >template = use_dir ? xmprintf("%s/%s", TT.p, template) :
> xstrdup(template);
> >
> > -  if (toys.optflags & FLAG_u) {
> > -template = mktemp(template);
> > -  } else if (toys.optflags & FLAG_d ? !mkdtemp(template) :
> > mkstemp(template) == -1) {
> > -if (toys.optflags & FLAG_q) toys.exitval = 1;
> > -else perror_exit("Failed to create %s %s/%s",
> > -toys.optflags & FLAG_d ? "directory" : "file", TT.p, template);
> > +  // Point `s` and `e` to the start and end of the last region of
> XXes.
> > +  s = e = strrchr(template, 'X');
> > +  if (!e || e == template || *(e-1) != 'X') error_exit("need XX in
> template");
> > +  while (s >= template && *(s-1) == 'X') --s;
> > +  len = (e-s+1);
> > +
> > +  while (1) {
> > +struct stat sb;
> > +int i;
> > +
> > +xgetrandom(toybuf, len, 0);
> > +for (i = 0; i < len; ++i) {
> > +  // mktemp randomness is only from "A-Za-z0-9".
> > +  s[i] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
> > +  "abcdefghijklmnopqrstuvwxyz"
> > +  "0123456789"[toybuf[i] % (26*2+10)];
> > +}
>
> I wanted to avoid a "long long" division on 32 bit systems pulling in the
> function unnecessarily, and you only need 2 more chars for 64, and the
> "posix
> portable file character set" thing has 3 more (- . and _).
>
> > +if ((FLAG(u) && lstat(template, &sb) == -1 && errno == ENOENT) ||
> > +(FLAG(d) && mkdir(template, 0700) != -1) ||
> > +(open(template, O_CREAT|O_CLOEXEC, 0500) != -1)) break;
> > +if (errno == EEXIST) continue;
> > +if (FLAG(q)) {
> > +  toys.exitval = 1;
> > +  return;
> > +} else perror_exit("%s", template);
>
> I didn't see this until just now (see "list mass unsubscribe again"), but
> I'll
> try to take a proper look this weekend and see what I missed.
>

i think you missed an entire change? toybox ToT doesn't currently build.
mktemp assumes that xgetrandom returns bool and has a new WARN_ONLY flag,
but xgetrandom is void and doesn't have a special case for both getrandom
and /dev not being available...


> Rob
>
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [PATCH] mktemp: fix the tests and the logic.

2018-12-07 Thread Rob Landley
On 12/7/18 10:15 AM, David Seikel wrote:
>> Sorry for the delay replying, gmail unsubscribed everybody from the
>> list again and I had to do the web gui dance.
> 
> I had left my read only gmail account on this list as a comparison to
> my account on my own email server.  As expected, the gmail one did the
> bouncy spam thing, mine didn't.  So I'll go and properly remove my
> gmail one now, should not be any of my gmail accounts left in your
> mailing lists anymore.  That's one less to dance for next time.

There's a little over 100 gmail accounts subscribed to the list. And the
dreamhost web interface can't _not_ sort them alphabetically, so I have to click
on every letter one at a time to bring up _that_ page of accounts and unclick
the ones with "B" as their disabled reason, then submit to reload the page, then
click on the next letter. (And there used to be some starting with digits, but
those apparently dropped off...)

My internet here in milwaukee is via phone tethering (never got a cable modem
for the apartment and I don't connect personal devices to the $DAYJOB network),
and since dreamhost's https support is only for the main website and _not_ the
lists.landley.net server, I prefer to do the unavoidably plaintext password
admin stuff via USB cable rather than wireless access point (so at least _one_
less hop is insecurely encrypted), and I didn't have a working USB cable with
me. (The little short one is a "charge but not carry data" cable, which I prefer
whem plugging into who knows what USB power to keep my phone charged, but didn't
have the other one in my backpack so had to do it when I got home.)

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [PATCH] mktemp: fix the tests and the logic.

2018-12-07 Thread David Seikel
> Sorry for the delay replying, gmail unsubscribed everybody from the
> list again and I had to do the web gui dance.

I had left my read only gmail account on this list as a comparison to
my account on my own email server.  As expected, the gmail one did the
bouncy spam thing, mine didn't.  So I'll go and properly remove my
gmail one now, should not be any of my gmail accounts left in your
mailing lists anymore.  That's one less to dance for next time.

-- 
A big old stinking pile of genius that no one wants
coz there are too many silver coated monkeys in the world.
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [PATCH] mktemp: yet more tests, and yet more fixes.

2018-12-07 Thread Rob Landley
On 12/6/18 10:52 AM, enh via Toybox wrote:
> We can't reuse the password.c code for random ASCII salts because that
> allows '/' (plus it seems to generate sequences of trailing '.'s for
> some reason). Do the simplest thing that could possibly work instead.

I need a week sometime to properly put the user account management stuff into
mkroot and get it all promoted.

Part of the reason it's further down my todo list is it's no use to Android
because PIDs mean something else there and login data would go in your version
of the registry instead of being unix-style text files anyway...

> ---
>  tests/mktemp.test |  6 ++
>  toys/lsb/mktemp.c | 34 --
>  2 files changed, 34 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/mktemp.test b/tests/mktemp.test
> index ee023d6b..0c235469 100755
> --- a/tests/mktemp.test
> +++ b/tests/mktemp.test
> @@ -37,3 +37,9 @@ testing "-p DIR -t TEMPLATE but no TMPDIR" "TMPDIR=
> mktemp -u -p DIR -t hello.XX
> 
>  # mktemp -u doesn't need to be able to write to the directory.
>  testing "-u" "mktemp -u -p /proc | grep -q '^/proc/tmp\...$'
> && echo yes" "yes\n" "" ""
> +
> +# mktemp needs at least XX in the template.
> +testing "bad template" "mktemp -u helloX || echo error" "error\n" "" ""

The one on ubuntu 14.04 required three XXX, so that's what I checked for...

> +# mktemp -q shouldn't print the path.
> +testing "-q" "mktemp -p /proc -q || echo only-failure" "only-failure\n" "" ""
> diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c
> index 57d1d118..55ab1aff 100644
> --- a/toys/lsb/mktemp.c
> +++ b/toys/lsb/mktemp.c
> @@ -37,6 +37,8 @@ void mktemp_main(void)
>int template_dir = template && !!strchr(template, '/');
>int flags_dir = (toys.optflags & (FLAG_p|FLAG_t));
>int use_dir = flags_dir && !template_dir;
> +  char *s, *e;
> +  int len;
> 
>if (template_dir && flags_dir) error_exit("conflicting directories given");
> 
> @@ -61,12 +63,32 @@ void mktemp_main(void)
>// TODO: coreutils cleans paths, so -p /t/// would result in /t/xxx...
>template = use_dir ? xmprintf("%s/%s", TT.p, template) : xstrdup(template);
> 
> -  if (toys.optflags & FLAG_u) {
> -template = mktemp(template);
> -  } else if (toys.optflags & FLAG_d ? !mkdtemp(template) :
> mkstemp(template) == -1) {
> -if (toys.optflags & FLAG_q) toys.exitval = 1;
> -else perror_exit("Failed to create %s %s/%s",
> -toys.optflags & FLAG_d ? "directory" : "file", TT.p, template);
> +  // Point `s` and `e` to the start and end of the last region of XXes.
> +  s = e = strrchr(template, 'X');
> +  if (!e || e == template || *(e-1) != 'X') error_exit("need XX in 
> template");
> +  while (s >= template && *(s-1) == 'X') --s;
> +  len = (e-s+1);
> +
> +  while (1) {
> +struct stat sb;
> +int i;
> +
> +xgetrandom(toybuf, len, 0);
> +for (i = 0; i < len; ++i) {
> +  // mktemp randomness is only from "A-Za-z0-9".
> +  s[i] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
> +  "abcdefghijklmnopqrstuvwxyz"
> +  "0123456789"[toybuf[i] % (26*2+10)];
> +}

I wanted to avoid a "long long" division on 32 bit systems pulling in the
function unnecessarily, and you only need 2 more chars for 64, and the "posix
portable file character set" thing has 3 more (- . and _).

> +if ((FLAG(u) && lstat(template, &sb) == -1 && errno == ENOENT) ||
> +(FLAG(d) && mkdir(template, 0700) != -1) ||
> +(open(template, O_CREAT|O_CLOEXEC, 0500) != -1)) break;
> +if (errno == EEXIST) continue;
> +if (FLAG(q)) {
> +  toys.exitval = 1;
> +  return;
> +} else perror_exit("%s", template);

I didn't see this until just now (see "list mass unsubscribe again"), but I'll
try to take a proper look this weekend and see what I missed.

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [PATCH] mktemp: fix the tests and the logic.

2018-12-07 Thread Rob Landley
On 12/6/18 1:11 PM, enh wrote:
> On Thu, Dec 6, 2018 at 10:48 AM Rob Landley  wrote:
>>
>> On 12/6/18 10:55 AM, enh wrote:
>>> it occurred to me overnight that the passwd code allows '/'. plus, as
>>> i've said, it seems to be slightly wrong. so i've just sent a
>>> replacement for my second patch (to be applied on top of the first
>>> patch) that just does the simplest xgetrandom + convert to valid
>>> character loop.
>>>
>>> can we at least get the first patch in, since mktemp is pretty broken
>>> right now (_except_ for -u, which was all the old tests exercised)?
>>
>> Can you send me just a tests/mktemp.test patch to demonstrate the failures? 
>> I'll
>> try to fix it this evening. (Too many changes at once, I need to know what
>> success looks like...)
> 
> you could just apply the two patches... that way you'll have the tests
> _and_ they'll pass. (the _real_ question is whether we're still
> missing important tests, since we were only testing -u until now. plus
> testing "the Xs get replaced with random data" is inherently hard to
> test.)
> 
> i've attached "just the tests" to this mail.

Sorry for the delay replying, gmail unsubscribed everybody from the list again
and I had to do the web gui dance.

I just pushed a version that passes all those tests, but there's probably more
corner cases to add to mktemp.test. My notes are to check what -p "" and
TMPDIR="" do (set but act like not set), look at unifying the passwd and salt
and mktemp random char functions, and my "I tested this while developing" cut
and paste backscroll is:

$ TMPDIR=. mktemp -u blah.XXX
blah.Iq2
$ TMPDIR=/tmp mktemp -u murgle blah.XXX
mktemp: too many templates
$ TMPDIR=/tmp mktemp -p murgle/ blah.XXX
mktemp: failed to create file via template ‘murgle/blah.XXX’: No such file or
directory
$ TMPDIR=/tmp mktemp -up murgle/ blah.XXX
murgle/blah.jjs
$ TMPDIR=/tmp mktemp -tup murgle/ blah.XXX
/tmp/blah.3NR
$ mktemp -tup murgle/ blah.XXX
murgle/blah.rel
$ mktemp -tup "" blah.XXX
blah.V6Q
$ TMPDIR=/woot mktemp -tup "" blah.XXX
/woot/blah.lpm
$ TMPDIR=/woot mktemp -up "" blah.XXX
/woot/blah.Fh5

But it is $DAYJOB time again...

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net