Deluser: deleting the home folder
Jason Cipriani
jason.cipriani at gmail.com
Thu Jul 3 19:41:13 UTC 2014
On Jul 3, 2014 3:31 PM, "tito" <farmatito at tiscali.it> wrote:
>
> On Thursday 03 July 2014 14:51:11 you wrote:
> > On Thu, Jul 3, 2014 at 12:59 PM, tito <farmatito at tiscali.it> wrote:
> >
> > > On Thursday 03 July 2014 13:03:46 Laszlo Papp wrote:
> > > > On Thu, Jul 3, 2014 at 11:10 AM, Laszlo Papp <lpapp at kde.org> wrote:
> > > >
> > > > > commit 761fd153e340a14abccc0af89f2f6617faf2077f
> > > > > Author: Laszlo Papp <lpapp at kde.org>
> > > > > Date: Thu Jul 3 11:06:58 2014 +0100
> > > > >
> > > > > Add optional home directory removal support to deluser
> > > > >
> > > > > diff --git a/loginutils/deluser.c b/loginutils/deluser.c
> > > > > index e39ac55..67b744b 100644
> > > > > --- a/loginutils/deluser.c
> > > > > +++ b/loginutils/deluser.c
> > > > > @@ -11,9 +11,10 @@
> > > > > */
> > > > >
> > > > > //usage:#define deluser_trivial_usage
> > > > > -//usage: "USER"
> > > > > +//usage: "[-h] USER"
> > > > > //usage:#define deluser_full_usage "\n\n"
> > > > > //usage: "Delete USER from the system"
> > > > > +//usage: "\n -h Remove the home directory"
> > > > >
> > > > > //usage:#define delgroup_trivial_usage
> > > > > //usage: IF_FEATURE_DEL_USER_FROM_GROUP("[USER] ")"GROUP"
> > > > > @@ -35,11 +36,15 @@ int deluser_main(int argc, char **argv)
> > > > > /* Name of shadow or gshadow file */
> > > > > const char *sfile;
> > > > > /* Are we deluser or delgroup? */
> > > > > + struct passwd *pw = 0;
> > > > >
> > > >
> > > > This could probably be one line below not to distract the comment
and
> > > > corresponding variable declaration. Although, ideally, this would
need to
> > > > go to the "case 2" branch, but I did not want to introduce a new
block
> > > > there with re-indenting many lines. Also, do you prefer "NULL"
instead of
> > > > "0"?
> > > >
> > > > Let me know what the preferred style is...
> > > >
> > > > The patch is tested with and without "-h" and it works. The option
> > > > selection is "-h" which reminds some people the canonical "help",
but on
> > > > the contrary, this is also what is used for adduser to create the
home
> > > > directory, so I picked it up for being consistent. Again, let me
know
> > > your
> > > > preference ...
> > > >
> > >
> > > Hi,
> > > couldn't we change -h as it conflicts with -h/--help and use -r as in
> > > --remove-home:
> > >
> >
> > Well, I prefer consistency, otherwise it will become to effectively use
the
> > applets. After all, if you do not type anything, you will get the help
> > output, or misuse it, so why would we bloat the applet code with that?
> >
>
> Hi,
> where is the bloat in doing:
>
> //usage:#define deluser_trivial_usage
> -//usage: "USER"
> +//usage: "[-r] USER"
> //usage:#define deluser_full_usage "\n\n"
> //usage: "Delete USER from the system"
> +//usage: "\n -r Remove the home directory"
>
>
> and
>
> int do_delhome = 0;
> if (getopt32(argv, "r") & 1) { ++argv; --argc; do_delhome = 1; }
>
> or maybe simply:
>
> int do_delhome = getopt32(argv, "r"):
> argc -= optind;
> argv += optind;
>
>
Agree with Tito.
Also it cannot be -h. There is no room for debate on that. It cannot
conflict with typical help flags regardless of how you think a user will
use it because users will use it in ways that you do not (for example,
temporarily tacking a -h on the end of an existing command line to see help
while maintaining the other parameters in the command history).
It is trivial to use -r and should be done. Otherwise a good new feature in
my opinion.
J
> Ciao,
> Tito
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140703/40573333/attachment.html>
More information about the busybox
mailing list