On Wed, 9 Feb 2005, Christian Perrier wrote:

Tomasz, this may be a good candidate for an upstream bug. Does it
still exist in 4.0.7?
[..]
Package: passwd
Version: 1:4.0.3-30.8
Severity: normal

postamt:/home/t# /usr/sbin/useradd -m -d /home/x/-/testruebe testruebe
useradd: cannot create directory /home/x/-/testruebe

postamt:/home/t# /usr/sbin/useradd -m -d "/home/x/-/testruebe" testruebe
useradd: cannot create directory /home/x/-/testruebe

postamt:/home/t# /usr/sbin/useradd -m -d "/home/x/\-/testruebe" testruebe
useradd: cannot create directory /home/x/\-/testruebe

If I create the /home/x/- directory by hand, useradd works.

This not bug in useradd and also this is not a bug :o)
Root above is in standard behavior of getopt(), getopt_long() functions.
From getopt(3) man page:

DESCRIPTION The getopt() function parses the command line arguments. Its arguments argc and argv are the argument count and array as passed to the main() function on program invocation. An element of argv that starts with '-' (and is not exactly "-" or "--") is an option element. The characters of this element (aside from the initial '-') are option characters. If getopt() is called repeatedly, it returns successively each of the option characters from each of the option elements.

So correct useradd commamd line parameters for above is:

# useradd -m -d -- /home/x/-/testruebe testruebe

kloczek
--
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: [EMAIL PROTECTED]

Reply via email to