[Toybox] Heads up on the sed N behavior change.

enh enh at google.com
Wed Sep 14 18:28:19 PDT 2022


On Tue, Sep 13, 2022 at 8:46 PM Rob Landley <rob at landley.net> wrote:

> On 9/13/22 16:25, enh wrote:
> > i'll keep an eye out, but since we _came_ from GNU sed, yeah, i'd be
> surprised
> > if we'd introduced any POSIX assumptions since then.
> >
> > for now though any update is still blocked on the chattr test breakage
> from
> > SKIPNEXT...
>
> Ah, didn't know that was blocking you. (The chattr tests don't run here
> because
> the number of - output by chattr, on both debian and toybox's version, is
> off by
> one from what the tests expect. It's still ext4, but...?)
>
> Anyway, took a blind stab at it, does 0fa628026cb3 fix it for you?
>

looks like it. thanks!


> I note that:
>
> -touch testFile; chattr -v 1234 testFile 2>/dev/null || SKIPNEXT=1
> +touch testFile && chattr -v 1234 testFile 2>/dev/null || ((++SKIP))
>
> I did that because it looked wrong otherwise, but that _could_ change
> behavior
> for you...?
>

not that i can tell: it looks like the same subset of the chattr toggle
tests is running both before and after.


> > -- chattr
>
> Sigh, more of Divya's tests. I tried to clean them up, but am still not
> always
> sure what they were intended to prove. Let's see...
>
> > /system/bin/sh: /data/local/tmp/toybox-tests/runtest.sh[222]: syntax
> error:
> > unexpected operator/operand '=~'
>
> Hmmm, I thought only sh was using the expect plumbing... ah right, mksh
> aborts
> processing that file with a syntax error but resumes the file that sourced
> it
> (the source produces an error rc but nothing checks it and everything
> sourced
> BEFORE then is populated, so... cosmetic but I should still fix. I have
> the todo
> item but haven't done it yet because the *pat* thing isn't right and toysh
> is SO
> CLOSE to being able to run the test suite. I've been distracted from
> that...)
>
> Right, not part of the failure you were seeing, just general noise I need
> to fix.
>

(yeah, like you i'm just ignoring this since it's not actually a problem.)


> > /system/bin/sh: can't create testFile: Operation not permitted
> > rm: testFile: Operation not permitted
> > PASS: chattr immutable
> > /system/bin/sh: can't create testFile: Operation not permitted
> > PASS: chattr append-only
>
> ALSO noise. Noisy but not failing. How is the test NOT failing? (No line
> numbers
> for the failures, that's nice of the shell...)
>
> Um, your commit ac932250f8ba seems to have changed these tests into
> something
> that passes if chattr fails? What exactly is this testing?
>

yeah, a skip would be better, but i think what's there is fine. (the chattr
succeeds on my test device.)


> > PASS: chattr toggle A
> > PASS: chattr toggle d
> > FAIL: chattr toggle e
> > echo -ne '' | lsattr testFile | awk '{print $1}' > attrs;
> >     grep -q e attrs || cat attrs; cat testFile && chattr -e testFile &&
> >     lsattr testFile | clean; rm -rf testFile
> > --- expected 2022-09-10 02:15:53.519998810 +0000
> > +++ actual 2022-09-10 02:15:53.559998809 +0000
> > @@ -1,2 +1,3 @@
> > +---------E----------
> >  abcdefghijklmnopqrstuvwxyz
> >  -------------------- testFile
>
> Well, hopefully it's skipping that now, although disabling the test if
> what we'd
> be testing doesn't work is... kind of strange? (Again, what does this test
> actually demonstrate? What have we proved by running it? I'm confused!)
>

read my extensive code comment :-P

# For the rest, just toggle the bits back and forth (where supported).
# Note that some file system/kernel combinations do return success but
# silently ignore your request: +T on 4.19 f2fs, or +F on 5.2 ext4,
# for example, so we're deliberately a bit selective here.
# f2fs in 5.6+ kernels supports compression, but you can only enable
# compression on a file while it's still empty, so we skip +c too.

basically "which subset of attributes you can actually test will depend on
the exact fs you're running on". so we test the ones we can, skip the ones
we can't.

as for what exactly we get out of this...

  # Check that $attr is in the lsattr output, then that - turns it back off.

It's a test that requires root to run so it's in my "run under mkroot"
> bucket,
> but still...
>

i'm not sure there's any one fs that supports all the things? (and, like i
always say, even if/when you do have that, there's still value to being
able to test in the production environment.)


> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220914/0fa2d6a2/attachment-0001.htm>


More information about the Toybox mailing list