[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Deluser: deleting the home folder
From:       Laszlo Papp <lpapp () kde ! org>
Date:       2014-07-16 12:28:32
Message-ID: CAOMwXhNMmfLO7gNc--ghRBJcvehN1OhXT2YwfRFzG-irGvrUzg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


This patch was sent to the mailing list two weeks ago without further
comment from the maintainer...


On Fri, Jul 4, 2014 at 11:15 AM, Laszlo Papp <lpapp@kde.org> wrote:

>
>
>
> On Thu, Jul 3, 2014 at 10:28 PM, tito <farmatito@tiscali.it> wrote:
>
>> On Thursday 03 July 2014 22:38:23 you wrote:
>> > On Thu, Jul 3, 2014 at 8:31 PM, tito <farmatito@tiscali.it> wrote:
>> >
>> > > On Thursday 03 July 2014 14:51:11 you wrote:
>> > > > On Thu, Jul 3, 2014 at 12:59 PM, tito <farmatito@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@kde.org>
>> wrote:
>> > > > > >
>> > > > > > > commit 761fd153e340a14abccc0af89f2f6617faf2077f
>> > > > > > > Author: Laszlo Papp <lpapp@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"
>> > >
>> >
>> > That does not make sense to me, I am afraid. It might be possible later
>> to
>> > remove other config data, too. It is probably not acceptable, thus it is
>> > not done so even on desktop.
>> >
>> >
>> > > 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;
>> > >
>> >
>> > This looks worse than a simple increment to me, but it is such a minor
>> > detail that I do not think it is too relevant.
>> >
>> > -h is nice and consistent. I do not know why you would want help option
>> two
>> > when it only has one option. You would double the option number. It
>> would
>> > be an overkill in this case.
>>
>> Hi,
>> I want not to double the number of options I just suggest to use
>> -r instead of -h because:
>>
>
> As already replied, -r is not clear an option. I was thinking about -h and
> --remove-home in the beginning. I think anything else is bad choice because
> it is inconsistent with the rest of the world. I prefer local consistency
> within busybox, this I picked up -h, but if Denys would like to avoid that
> local consistency, I suggest --remove-home to at least have some
> consistency, namely with the desktop.
>
>
>> 1) -h is mostly used for help (with a few exceptions I am aware of).
>> 2)  on the desktop:
>>       a) deluser uses  --remove-home   ( Remove the home directory of the
>> user and its mailspool)
>>       b) userdel uses  -r, --remove  (Files in the user's home directory
>> will be removed along with the
>>                                                       home directory
>> itself and the user's mail spool.)
>>          therefore using -r would be consistent and logic to use.
>>
>
> That is exactly why it would be inconsistent and not logical IMHO. "-r"
> means remove "everything" and definitely not just home.
>
>
>>
>> > By the way, I like the bikeshed pink. ;-)
>>
>>      This was just a hint to reduce codesize,
>>      untested  so I will not bet on it.
>>
>>      int do_delhome = getopt32(argv, "r"):
>>      argc -= optind;
>>      argv += optind;
>>
>
> I do not see any benefit of it for one option; it also seems to make the
> code longer IMHO.
>

[Attachment #5 (text/html)]

<div dir="ltr">This patch was sent to the mailing list two weeks ago without further \
comment from the maintainer...</div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Fri, Jul 4, 2014 at 11:15 AM, Laszlo Papp <span \
dir="ltr">&lt;<a href="mailto:lpapp@kde.org" \
target="_blank">lpapp@kde.org</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div \
class="gmail_quote"><div><div class="h5">On Thu, Jul 3, 2014 at 10:28 PM, tito <span \
dir="ltr">&lt;<a href="mailto:farmatito@tiscali.it" \
target="_blank">farmatito@tiscali.it</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>On \
Thursday 03 July 2014 22:38:23 you wrote:<br>


&gt; On Thu, Jul 3, 2014 at 8:31 PM, tito &lt;<a href="mailto:farmatito@tiscali.it" \
target="_blank">farmatito@tiscali.it</a>&gt; wrote:<br> &gt;<br>
&gt; &gt; On Thursday 03 July 2014 14:51:11 you wrote:<br>
&gt; &gt; &gt; On Thu, Jul 3, 2014 at 12:59 PM, tito &lt;<a \
href="mailto:farmatito@tiscali.it" target="_blank">farmatito@tiscali.it</a>&gt; \
wrote:<br> &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; On Thursday 03 July 2014 13:03:46 Laszlo Papp wrote:<br>
&gt; &gt; &gt; &gt; &gt; On Thu, Jul 3, 2014 at 11:10 AM, Laszlo Papp &lt;<a \
href="mailto:lpapp@kde.org" target="_blank">lpapp@kde.org</a>&gt; wrote:<br> &gt; \
&gt; &gt; &gt; &gt;<br> &gt; &gt; &gt; &gt; &gt; &gt; commit \
761fd153e340a14abccc0af89f2f6617faf2077f<br> &gt; &gt; &gt; &gt; &gt; &gt; Author: \
Laszlo Papp &lt;<a href="mailto:lpapp@kde.org" \
target="_blank">lpapp@kde.org</a>&gt;<br> &gt; &gt; &gt; &gt; &gt; &gt; Date:    Thu \
Jul 3 11:06:58 2014 +0100<br> &gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt;       Add optional home directory removal support to \
deluser<br> &gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; diff --git a/loginutils/deluser.c \
b/loginutils/deluser.c<br> &gt; &gt; &gt; &gt; &gt; &gt; index e39ac55..67b744b \
100644<br> &gt; &gt; &gt; &gt; &gt; &gt; --- a/loginutils/deluser.c<br>
&gt; &gt; &gt; &gt; &gt; &gt; +++ b/loginutils/deluser.c<br>
&gt; &gt; &gt; &gt; &gt; &gt; @@ -11,9 +11,10 @@<br>
&gt; &gt; &gt; &gt; &gt; &gt;    */<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt;   //usage:#define deluser_trivial_usage<br>
&gt; &gt; &gt; &gt; &gt; &gt; -//usage:          &quot;USER&quot;<br>
&gt; &gt; &gt; &gt; &gt; &gt; +//usage:          &quot;[-h] USER&quot;<br>
&gt; &gt; &gt; &gt; &gt; &gt;   //usage:#define deluser_full_usage \
&quot;\n\n&quot;<br> &gt; &gt; &gt; &gt; &gt; &gt;   //usage:          &quot;Delete \
USER from the system&quot;<br> &gt; &gt; &gt; &gt; &gt; &gt; +//usage:          \
&quot;\n      -h    Remove the home directory&quot;<br> &gt; &gt; &gt; &gt; &gt; \
&gt;<br> &gt; &gt; &gt; &gt; &gt; &gt;   //usage:#define delgroup_trivial_usage<br>
&gt; &gt; &gt; &gt; &gt; &gt;   //usage:          \
IF_FEATURE_DEL_USER_FROM_GROUP(&quot;[USER] &quot;)&quot;GROUP&quot;<br> &gt; &gt; \
&gt; &gt; &gt; &gt; @@ -35,11 +36,15 @@ int deluser_main(int argc, char **argv)<br> \
&gt; &gt; &gt; &gt; &gt; &gt;             /* Name of shadow or gshadow file */<br> \
&gt; &gt; &gt; &gt; &gt; &gt;             const char *sfile;<br> &gt; &gt; &gt; &gt; \
&gt; &gt;             /* Are we deluser or delgroup? */<br> &gt; &gt; &gt; &gt; &gt; \
&gt; +      struct passwd *pw = 0;<br> &gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; This could probably be one line below not to distract the \
comment and<br> &gt; &gt; &gt; &gt; &gt; corresponding variable declaration. \
Although, ideally, this would<br> &gt; &gt; need to<br>
&gt; &gt; &gt; &gt; &gt; go to the &quot;case 2&quot; branch, but I did not want to \
introduce a new<br> &gt; &gt; block<br>
&gt; &gt; &gt; &gt; &gt; there with re-indenting many lines. Also, do you prefer \
&quot;NULL&quot;<br> &gt; &gt; instead of<br>
&gt; &gt; &gt; &gt; &gt; &quot;0&quot;?<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Let me know what the preferred style is...<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; The patch is tested with and without &quot;-h&quot; and it \
works. The option<br> &gt; &gt; &gt; &gt; &gt; selection is &quot;-h&quot; which \
reminds some people the canonical &quot;help&quot;,<br> &gt; &gt; but on<br>
&gt; &gt; &gt; &gt; &gt; the contrary, this is also what is used for adduser to \
create the<br> &gt; &gt; home<br>
&gt; &gt; &gt; &gt; &gt; directory, so I picked it up for being consistent. Again, \
let me know<br> &gt; &gt; &gt; &gt; your<br>
&gt; &gt; &gt; &gt; &gt; preference ...<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt; &gt; couldn&#39;t we change -h as it conflicts with -h/--help and use \
-r as in<br> &gt; &gt; &gt; &gt; --remove-home:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Well, I prefer consistency, otherwise it will become to effectively \
use<br> &gt; &gt; the<br>
&gt; &gt; &gt; applets. After all, if you do not type anything, you will get the \
help<br> &gt; &gt; &gt; output, or misuse it, so why would we bloat the applet code \
with that?<br> &gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt; where is the bloat in doing:<br>
&gt; &gt;<br>
&gt; &gt;   //usage:#define deluser_trivial_usage<br>
&gt; &gt; -//usage:          &quot;USER&quot;<br>
&gt; &gt; +//usage:          &quot;[-r] USER&quot;<br>
&gt; &gt;   //usage:#define deluser_full_usage &quot;\n\n&quot;<br>
&gt; &gt;   //usage:          &quot;Delete USER from the system&quot;<br>
&gt; &gt; +//usage:          &quot;\n      -r    Remove the home directory&quot;<br>
&gt; &gt;<br>
&gt;<br>
&gt; That does not make sense to me, I am afraid. It might be possible later to<br>
&gt; remove other config data, too. It is probably not acceptable, thus it is<br>
&gt; not done so even on desktop.<br>
&gt;<br>
&gt;<br>
&gt; &gt; and<br>
&gt; &gt;<br>
&gt; &gt;       int do_delhome = 0;<br>
&gt; &gt;       if (getopt32(argv, &quot;r&quot;) &amp; 1) { ++argv; --argc; \
do_delhome = 1; }<br> &gt; &gt;<br>
&gt; &gt; or maybe simply:<br>
&gt; &gt;<br>
&gt; &gt;       int do_delhome = getopt32(argv, &quot;r&quot;):<br>
&gt; &gt;       argc -= optind;<br>
&gt; &gt;       argv += optind;<br>
&gt; &gt;<br>
&gt;<br>
&gt; This looks worse than a simple increment to me, but it is such a minor<br>
&gt; detail that I do not think it is too relevant.<br>
&gt;<br>
&gt; -h is nice and consistent. I do not know why you would want help option two<br>
&gt; when it only has one option. You would double the option number. It would<br>
&gt; be an overkill in this case.<br>
<br>
</div></div>Hi,<br>
I want not to double the number of options I just suggest to use<br>
-r instead of -h because:<br></blockquote><div><br></div></div></div><div>As already \
replied, -r is not clear an option. I was thinking about -h and --remove-home in the \
beginning. I think anything else is bad choice because it is inconsistent with the \
rest of the world. I prefer local consistency within busybox, this I picked up -h, \
but if Denys would like to avoid that local consistency, I suggest --remove-home to \
at least have some consistency, namely with the desktop.<br>

</div><div class=""><div>  </div><blockquote class="gmail_quote" style="margin:0px \
0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">1) \
-h is mostly used for help (with a few exceptions I am aware of).<br>


2)   on the desktop:<br>
         a) deluser uses   --remove-home    ( Remove the home directory of the user \
                and its mailspool)<br>
         b) userdel uses   -r, --remove   (Files in the user&#39;s home directory \
                will be removed along with the<br>
                                                                                 home \
directory itself and the user&#39;s mail spool.)<br>  therefore using -r would be \
consistent and logic to use.<br></blockquote><div><br></div></div><div>That is \
exactly why it would be inconsistent and not logical IMHO. &quot;-r&quot; means \
remove &quot;everything&quot; and definitely not just home.</div> <div class="">
<div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 <div><br>
&gt; By the way, I like the bikeshed pink. ;-)<br>
<br>
</div>        This was just a hint to reduce codesize,<br>
        untested   so I will not bet on it.<br>
<div><br>
        int do_delhome = getopt32(argv, &quot;r&quot;):<br>
        argc -= optind;<br>
        argv += optind;<br></div></blockquote><div><br></div></div><div>I do not see \
any benefit of it for one option; it also seems to make the code longer \
IMHO.</div></div></div></div> </blockquote></div><br></div>



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic