Bug#377387: [Adduser-devel] Bug#377387: Improvements for the program output

Tobias Toedter t.toedter at gmx.net
Sat Jul 8 17:27:12 UTC 2006


On Saturday 08 July 2006 18:32, Marc Haber wrote:
> On Sat, Jul 08, 2006 at 05:56:05PM +0200, Tobias Toedter wrote:
> > 1. UID/GID are not written in uppercase everywhere (uid/gid appears as
> > well)
>
> I am not sure wheter it would be better to write uid/gid. Is there an
> accepted standard for thhis writing?

No, none that I'm aware of. If you think that uid/gid would be better, feel 
free to change the uppercase UID/GID to lowercase. The main point here was 
to keep the messages consistent.

However, I think that UID/GID makes it clearer to the user that we're 
talking about a variable. The uppercase version has been used in the 
program's usage output as well. As an alternative, you could write "user 
id" and "group id".

> > 4. I've replaced %s with %d where applicable, to ease the understanding
> > for translators
>
> Is that compatible and does not generate decimal numbers with fractions?

Yes, %d will display an integer value, even if you supply a fractional 
number. In that case, the number will be converted to integer 
automatically. If you want to display fractions, you would need to use %f 
instead.

> > 9. A few output strings which were not shown with gtx() have been added
> > now
>
> Please try the changes, there are a few places where we hat to omit
> gtx for obscure reasons.

I guess these places are where you use Perl variables in the output, 
e.g. "Could not create user $new_user: $!\n". You cannot use gtx then, 
because it will irritate xgettext. That's why I enclosed the calls to gtx() 
with calls to sprintf().

I have checked all newly introduced gtx() calls, they work fine. Expect one 
small mistake: in AdduserCommon.pm, the call to die() has been replaced 
with dief(), which prepends the output with "$0:" itself. Therefore the 
following patch fragment needs to be replaced:

@@ -155,9 +155,9 @@
     my $c = join(' ', @_);
     print ("$c\n") if $verbose==2;
     if (system(@_)) {
-        die ("$0: `$c' returned error code " . ($?>>8) . ".  Aborting.\n")
+        dief (gtx("%s: `%s' returned error code %d. Exiting.\n"), $0, $c, 
$?>>8)
           if ($?>>8);
-        die ("$0: `$c' exited from signal " . ($?&255) . ".  Aborting.\n");
+        dief (gtx("%s: `%s' exited from signal %d. Exiting.\n"), $0, $c, 
$?&255);
     }
 }
 

Change the calls to dief() to read as follows:

dief (gtx("`%s' returned error code %d. Exiting.\n"), $c, $?>>8)
and
dief (gtx("`%s' exited from signal %d. Exiting.\n"), $c, $?&255);

> I'll need to review the Y/n stuff you changed, there was no time at
> the moment.

OK.

> After the issues mentioned above have been resolved, I'll apply your
> patch in svn. Thanks for helping.

Thanks for your quick feedback.

Regards,
Tobias

-- 
Tobias Toedter   | "To be is to do"  -- Plato
Hamburg, Germany | "To do is to be"  -- Aristotle
                 | "Do be do be do"  -- Sinatra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20060708/ca0a5696/attachment.pgp


More information about the Adduser-devel mailing list