Giter Club home page Giter Club logo

Comments (6)

ukai avatar ukai commented on July 17, 2024

or exit 100 will be reported as exit 0 ?

https://github.com/google/nsjail/blob/master/subproc.cc#L322

and seems strange about here too
https://github.com/google/nsjail/blob/master/subproc.cc#L334

from nsjail.

robertswiecki avatar robertswiecki commented on July 17, 2024

Hi,

I don't think so, the following should catch it

				if (rv == 0 && WEXITSTATUS(status) != 0) {
					rv = 1;
				}

as for the signal value, it's maximally 127, so it'll be 227, which is good exit value IMO.

In any case, I tested it

$ ./nsjail -q --chroot / -- /bin/sh -c 'exit 99'
$ echo $?
99
$ ./nsjail -q --chroot / -- /bin/sh -c 'exit 100'
$ echo $?
1
$ ./nsjail -q --chroot / -- /bin/sh -c 'exit 101'
$ echo $?
1

from nsjail.

ukai avatar ukai commented on July 17, 2024

ah, I didn't check it that.

anyway, I'm surprised we got exit status 55, which nsjail logs exit with 255.
why it takes mod 100 ? not 0x100 ?

from nsjail.

robertswiecki avatar robertswiecki commented on July 17, 2024

We need to represent signal exits somehow. And the only accessible to us values are 0-255.

We can definitely change something, but this is how more-or-less bash works.

Though, it simply exits with 128+signal in case of signal.

I can replicate this behavior if you think it's better

$ /bin/sh -c 'exit 137'
$ echo $?
137
$ /bin/sh -c 'kill -9 $$'
Killed
$ echo $?
137
$ /bin/sh -c 'exit 255'
$ echo $?
255

from nsjail.

robertswiecki avatar robertswiecki commented on July 17, 2024

Done in ffd8360

from nsjail.

ukai avatar ukai commented on July 17, 2024

lgtm

from nsjail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.