Age | Commit message (Collapse) | Author |
|
glibc doesn't set errno when getpw* fails, so the perror_exit() looked
fine. bionic sets ENOENT and the trailing "No such file or directory"
looks silly, so switch to error_exit().
Additionally, the default format tests fail on Android because of
SELinux (but for a different reason than usual!). There's no id
--no-context flag, so use sed to just throw away any SELinux context.
|
|
The previous patch broke -nG, so move the -G code back to showone()
which handles -n.
Add the missing tests for the various uses of -n.
Also refactor the code to avoid the need to test optflags directly.
|
|
Handle unknown groups (fixes #117).
Fix -G to show *all* groups, not just all supplementary groups.
Fix -Z output to not include "context=".
|
|
Fall back to converting the "name" to an integer and calling getpwuid().
We need to update `username` for the later call to getgrouplist().
Also fix the separator printing logic to avoid a trailing ',' on `id 0`.
Switch to FLAG() and move some declarations down to where they can be
initialized, both for clarity.
Also add simple tests. Sadly, there's no always-present user that is in
multiple groups.
|
|
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
Both should only output the groups.
|
|
|
|
|
|
make lib/lsm.h auto-include from toys.h.
|
|
confusing update-alternatives, the paths of the links installed by toybox should
match those installed by busybox. This is accomplished by changing the flags
of a few tools within toybox.
|
|
|
|
the SELinux commands (such as chcon) and the SELinux-specific options
to regular commands (such as ls -Z).
This lets us #include <selinux/selinux.h> in portability.h.
I've also fixed chcon to insist on being given the a context argument.
This patch also adds -Z to id and fixes id's regular output (-G should
be separated by spaces, non-G output should be separated by commas,
and you don't want a double comma where the egid is omitted from the
list of groups).
|
|
macros for a disabled command (needed when multiple commands share infrastructure with a common set of flags).
This means the flag space is no longer packed, but leaves gaps where the zeroes
go. (Actual flag bit positions are the same for all configs.) Since the
option parsing needs to know where the holes are, the OPTSTR values are
now generated as part of flags.h with ascii 1 values for the disabled values.
(So generated/oldflags.h went away.)
This also means that the option string argument for OLDTOY() went away, it now
uses the same arguments as the NEWTOY() it references.
|
|
analysis, plus occasional tweak by me while reviewing them.
|
|
|
|
|
|
Since the starting letters are greater than those for 'id' or 'groups',
we cn just check if the first letter is greater than 'i'.
|
|
|
|
|
|
|
|
|
|
without leading space), enforce max 1 argument and at most one of Ggu.
|
|
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
|
|
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
|
|
|
|
|