Re: Deluser: deleting the home folder
On Thu, Feb 5, 2015 at 9:03 PM, tito farmat...@tiscali.it wrote: On Thursday 05 February 2015 19:48:47 Laszlo Papp wrote: On Thu, Feb 5, 2015 at 6:41 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. Sure, but busybox has short option in other cases for such operation, so you need incompatibility somewhere anyway. In addition, the long option is not the problem. The problem is that the functionality is switched off by switching the long option off, rather than the actual functionality. Therefore, busybox does not remain as fine-tunable as possible. Which is why I said it was a bad idea in my opinion. I would like to be able to customize busybox to only include things what I want. Currently, if I do not want long options, but I do want this small feature, I have to get everything. This is against the minimal project principles. Hi, i would dare to suggest to use: -r for --remove-home and reserve -R for --remove-all-files (if we ever implement it). this would reduce incompatibility to a mininum. Incompatibility is bad. And this bad of it tends to bite some years after. It doesn't seem like a big deal when a developer of a system decides to use deluser -r and save, you know, whole 2687 bytes in busybox binary which otherwise would be there because of CONFIG_LONG_OPTS=y for standard form, namely, deluser --remove-home to work. Then years someone else will spend many hours upon customer reports why delete user operation in someone's modem stopped working. After much decoding of web code and scripts, they will discover that it's because someone smart decided to use non-standard deluser -r to save tiny, tiny 2.7kb of flash/RAM. (In my test, it's less than 1/300th of busybox binary size). I can imagine their reaction. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Saturday 07 February 2015 16:45:34 you wrote: On Thu, Feb 5, 2015 at 9:03 PM, tito farmat...@tiscali.it wrote: On Thursday 05 February 2015 19:48:47 Laszlo Papp wrote: On Thu, Feb 5, 2015 at 6:41 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. Sure, but busybox has short option in other cases for such operation, so you need incompatibility somewhere anyway. In addition, the long option is not the problem. The problem is that the functionality is switched off by switching the long option off, rather than the actual functionality. Therefore, busybox does not remain as fine-tunable as possible. Which is why I said it was a bad idea in my opinion. I would like to be able to customize busybox to only include things what I want. Currently, if I do not want long options, but I do want this small feature, I have to get everything. This is against the minimal project principles. Hi, i would dare to suggest to use: -r for --remove-home and reserve -R for --remove-all-files (if we ever implement it). this would reduce incompatibility to a mininum. Incompatibility is bad. And this bad of it tends to bite some years after. It doesn't seem like a big deal when a developer of a system decides to use deluser -r and save, you know, whole 2687 bytes in busybox binary which otherwise would be there because of CONFIG_LONG_OPTS=y for standard form, namely, deluser --remove-home to work. Then years someone else will spend many hours upon customer reports why delete user operation in someone's modem stopped working. After much decoding of web code and scripts, they will discover that it's because someone smart decided to use non-standard deluser -r to save tiny, tiny 2.7kb of flash/RAM. (In my test, it's less than 1/300th of busybox binary size). I can imagine their reaction. Hi, i see your point, but I recall we did this before in bb's code to keep some options that originally had only long options working even without long options enabled. Still i feel that the actual solution is not optimal, a more formally correct one should be: add a CONFIG_DELUSER_DELHOME make it turn on CONFiG_LONG_OPTS and add a line to the help text of CONFIG_DELUSER_DELHOME to explain it. But you are the boss. Ciao, Tito ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thursday, February 5, 2015, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 7:48 PM, Laszlo Papp lp...@kde.org wrote: On Thu, Feb 5, 2015 at 6:41 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. Sure, but busybox has short option in other cases for such operation, so you need incompatibility somewhere anyway. I think it was a mistake to add incompatible short options to applets whose standard versions had only long options. In addition, the long option is not the problem. The problem is that the functionality is switched off by switching the long option off, rather than the actual functionality. It's about 6.5 kbytes of code in static build. Therefore, busybox does not remain as fine-tunable as possible. There are two extremes: not having any tuning knobs, and having a tuning know for every possible case. Both are bad. The latter one too - you will need to answer to thousands of questions in make config. I tend to add new knobs (CONFIG_xyz) when somebody is pissed enough to complain about it. Do you want to add CONFIG_FEATURE_DELUSER_LONG_OPTIONS? Yes, if you are also happy with that. Your patch otherwise is ok to me, thanks for following this up and apologies if I had been pushy. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thursday 05 February 2015 19:48:47 Laszlo Papp wrote: On Thu, Feb 5, 2015 at 6:41 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. Sure, but busybox has short option in other cases for such operation, so you need incompatibility somewhere anyway. In addition, the long option is not the problem. The problem is that the functionality is switched off by switching the long option off, rather than the actual functionality. Therefore, busybox does not remain as fine-tunable as possible. Which is why I said it was a bad idea in my opinion. I would like to be able to customize busybox to only include things what I want. Currently, if I do not want long options, but I do want this small feature, I have to get everything. This is against the minimal project principles. Hi, i would dare to suggest to use: -r for --remove-home and reserve -R for --remove-all-files (if we ever implement it). this would reduce incompatibility to a mininum. I am aware that this is not Laslo's preferred solution but for me looks better than mixing long options and remove home functionality. Just my 0.2 cents. Ciao, Tito ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Wed, Feb 4, 2015 at 4:51 PM, Laszlo Papp lp...@kde.org wrote: Another desperate ping? Applied the attached patch. diff -d -urpN busybox.7/loginutils/deluser.c busybox.8/loginutils/deluser.c --- busybox.7/loginutils/deluser.c 2014-11-27 23:31:08.0 +0100 +++ busybox.8/loginutils/deluser.c 2015-02-05 18:31:40.066877950 +0100 @@ -11,9 +11,10 @@ */ //usage:#define deluser_trivial_usage -//usage: USER +//usage: IF_LONG_OPTS([--remove-home] ) USER //usage:#define deluser_full_usage \n\n //usage: Delete USER from the system +// --remove-home is self-explanatory enough to put it in --help //usage:#define delgroup_trivial_usage //usage: IF_FEATURE_DEL_USER_FROM_GROUP([USER] )GROUP @@ -37,6 +38,19 @@ int deluser_main(int argc, char **argv) /* Are we deluser or delgroup? */ int do_deluser = (ENABLE_DELUSER (!ENABLE_DELGROUP || applet_name[3] == 'u')); +#if !ENABLE_LONG_OPTS + const int opt_delhome = 0; +#else + int opt_delhome = 0; + if (do_deluser) { + applet_long_options = + remove-home\0 No_argument \xff; + opt_delhome = getopt32(argv, ); + argv += opt_delhome; + argc -= opt_delhome; + } +#endif + if (geteuid() != 0) bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); @@ -55,10 +69,14 @@ int deluser_main(int argc, char **argv) case 2: if (do_deluser) { /* deluser USER */ - xgetpwnam(name); /* bail out if USER is wrong */ + struct passwd *pw; + + pw = xgetpwnam(name); /* bail out if USER is wrong */ pfile = bb_path_passwd_file; if (ENABLE_FEATURE_SHADOWPASSWDS) sfile = bb_path_shadow_file; + if (opt_delhome) +remove_file(pw-pw_dir, FILEUTILS_RECUR); } else { struct group *gr; do_delgroup: ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. On Thu, Feb 5, 2015 at 5:37 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Wed, Feb 4, 2015 at 4:51 PM, Laszlo Papp lp...@kde.org wrote: Another desperate ping? Applied the attached patch. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Feb 5, 2015 at 6:41 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. Sure, but busybox has short option in other cases for such operation, so you need incompatibility somewhere anyway. In addition, the long option is not the problem. The problem is that the functionality is switched off by switching the long option off, rather than the actual functionality. Therefore, busybox does not remain as fine-tunable as possible. Which is why I said it was a bad idea in my opinion. I would like to be able to customize busybox to only include things what I want. Currently, if I do not want long options, but I do want this small feature, I have to get everything. This is against the minimal project principles. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Feb 5, 2015 at 7:48 PM, Laszlo Papp lp...@kde.org wrote: On Thu, Feb 5, 2015 at 6:41 PM, Denys Vlasenko vda.li...@googlemail.com wrote: On Thu, Feb 5, 2015 at 6:49 PM, Laszlo Papp lp...@kde.org wrote: I think it is bad idea to only allow this operation when long options are enabled. Long options and this functionality are two separate things in my book. Standard deluser has only long options. Incompatibility is not a good thing. Sure, but busybox has short option in other cases for such operation, so you need incompatibility somewhere anyway. I think it was a mistake to add incompatible short options to applets whose standard versions had only long options. In addition, the long option is not the problem. The problem is that the functionality is switched off by switching the long option off, rather than the actual functionality. It's about 6.5 kbytes of code in static build. Therefore, busybox does not remain as fine-tunable as possible. There are two extremes: not having any tuning knobs, and having a tuning know for every possible case. Both are bad. The latter one too - you will need to answer to thousands of questions in make config. I tend to add new knobs (CONFIG_xyz) when somebody is pissed enough to complain about it. Do you want to add CONFIG_FEATURE_DELUSER_LONG_OPTIONS? ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
Denys, could you please provide feedback here? 1) Do you appreciate the feature? 2) If yes, which option would you like to see for it? On Wed, Jul 16, 2014 at 1:28 PM, Laszlo Papp lp...@kde.org wrote: 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 lp...@kde.org wrote: On Thu, Jul 3, 2014 at 10:28 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 22:38:23 you wrote: On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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.
Re: Deluser: deleting the home folder
Indeed, thanks, and sorry. ^^ On Mon, Aug 4, 2014 at 6:21 PM, Denys Dmytriyenko de...@denix.org wrote: Laszlo, I think you meant the other Denys, the one with RedHat that maintains busybox. I'm with Texas Instruments and maintain meta-ti/Arago in OE/Yocto world :) -- Denys On Mon, Aug 04, 2014 at 06:10:40PM +0100, Laszlo Papp wrote: Denys, could you please provide feedback here? 1) Do you appreciate the feature? 2) If yes, which option would you like to see for it? On Wed, Jul 16, 2014 at 1:28 PM, Laszlo Papp lp...@kde.org wrote: 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 lp...@kde.org wrote: On Thu, Jul 3, 2014 at 10:28 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 22:38:23 you wrote: On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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
Re: Deluser: deleting the home folder
Laszlo, I think you meant the other Denys, the one with RedHat that maintains busybox. I'm with Texas Instruments and maintain meta-ti/Arago in OE/Yocto world :) -- Denys On Mon, Aug 04, 2014 at 06:10:40PM +0100, Laszlo Papp wrote: Denys, could you please provide feedback here? 1) Do you appreciate the feature? 2) If yes, which option would you like to see for it? On Wed, Jul 16, 2014 at 1:28 PM, Laszlo Papp lp...@kde.org wrote: 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 lp...@kde.org wrote: On Thu, Jul 3, 2014 at 10:28 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 22:38:23 you wrote: On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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
Re: Deluser: deleting the home folder
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 lp...@kde.org wrote: On Thu, Jul 3, 2014 at 10:28 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 22:38:23 you wrote: On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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
Re: Deluser: deleting the home folder
On Thu, Jul 3, 2014 at 10:28 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 22:38:23 you wrote: On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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;
Re: Deluser: deleting the home folder
commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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; int do_deluser = (ENABLE_DELUSER (!ENABLE_DELGROUP || applet_name[3] == 'u')); if (geteuid() != 0) bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); +int do_delhome = 0; +if (getopt32(argv, h) 1) { ++argv; --argc; do_delhome = 1; } + name = argv[1]; member = NULL; @@ -55,7 +60,7 @@ int deluser_main(int argc, char **argv) case 2: if (do_deluser) { /* deluser USER */ - xgetpwnam(name); /* bail out if USER is wrong */ + pw = xgetpwnam(name); /* bail out if USER is wrong */ pfile = bb_path_passwd_file; if (ENABLE_FEATURE_SHADOWPASSWDS) sfile = bb_path_shadow_file; @@ -108,6 +113,8 @@ int deluser_main(int argc, char **argv) do_deluser = -1; goto do_delgroup; } +if (do_delhome pw remove_file(pw-pw_dir, FILEUTILS_RECUR) 0) +bb_error_msg(can't remove home: %s, pw-pw_dir); return EXIT_SUCCESS; } /* Reached only if number of command line args is wrong */ ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Jul 3, 2014 at 11:10 AM, Laszlo Papp lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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 ... ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thursday 03 July 2014 13:03:46 Laszlo Papp wrote: On Thu, Jul 3, 2014 at 11:10 AM, Laszlo Papp lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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: deluser USER remove a normal user from the system example: deluser mike --remove-home remove the users home directory and mail spool userdel --help Usage: userdel [options] LOGIN Options: -r, --remove remove home directory and mail spool Ciao, Tito ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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? ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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; Ciao, Tito ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Jul 3, 2014 3:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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@busybox.net http://lists.busybox.net/mailman/listinfo/busybox ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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. By the way, I like the bikeshed pink. ;-) ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thu, Jul 3, 2014 at 8:41 PM, Jason Cipriani jason.cipri...@gmail.com wrote: On Jul 3, 2014 3:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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). I did not get the bit in brackets... Either way, why is it difficult to type the command name to get the help output? Busybox is meant for embedded where needless code bloat should be avoided IMHO. Even the basic applets, like rm, vi, kill, chroot, etc do not have help option and I like that behavior! It is trivial to use -r and should be done. Otherwise a good new feature in my opinion. That is probably the worst choice here so far IMHO because: 1) It is inconsistent with the rest of the applets. 2) It is inconsistent with desktop, too. 3) Home is not the only thing that you could remove. ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: Deluser: deleting the home folder
On Thursday 03 July 2014 22:38:23 you wrote: On Thu, Jul 3, 2014 at 8:31 PM, tito farmat...@tiscali.it wrote: On Thursday 03 July 2014 14:51:11 you wrote: On Thu, Jul 3, 2014 at 12:59 PM, tito farmat...@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 lp...@kde.org wrote: commit 761fd153e340a14abccc0af89f2f6617faf2077f Author: Laszlo Papp lp...@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: 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. 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; Ciao, Tito ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox