Re: Error in softraid documentation?

Previous thread: Re: mailing list server downtime by Darrin Chandler on Saturday, January 26, 2008 - 11:33 pm. (1 message)

Next thread: Re: mysqld: Error in accept: Bad file descriptor by Takumitsu Itoh on Saturday, January 26, 2008 - 11:07 am. (2 messages)
To: <misc@...>
Date: Saturday, January 26, 2008 - 10:11 pm

I recently noticed that the examples in the softraid man page

http://www.openbsd.org/cgi-bin/man.cgi?query=softraid

contain many lines such as

echo "d a\na\n\n\n\nRAID\nw\nq\n" | disklabel -E wd1

Of course, not every version of echo interprets "\n" as a newline. In
fact, /bin/echo treats "\n" as a literal backslash followed by a literal
n. The version of echo that is built into csh also interprets it as a
literal backslash followed by a literal n. But the softraid man page
certainly intends it to be interpreted as a newline.

So, is the man page in error? Or are the examples in man pages only
intended for use in the default shell? (Note that ksh is the default
shell, and ksh has a built-in echo command that interprets "\n" as a
newline.)

To: Matthew Szudzik <mszudzik@...>
Cc: <misc@...>
Date: Monday, January 28, 2008 - 9:49 pm

On Jan 26, 2008 7:11 PM, Matthew Szudzik <mszudzik@andrew.cmu.edu> wrote:

Sounds like it should use printf(1) instead of echo(1), as that does
have consistent behavior between shells (and platforms).

Philip

To: Matthew Szudzik <mszudzik@...>
Cc: <marco@...>, <misc@...>
Date: Monday, January 28, 2008 - 9:49 pm

well, the man page is not exactly in error - it just presupposes the use
of the default shell. unfortunately /bin/echo does not support character
sequences such as "\n", even though they are noted as mandated by XSI.
bummer.

marco: can we use printf(1) instead? i think we'd need an extra "\n" (no
idea why):

echo "d a\na\n\n\n\nRAID\nw\nq\n"
would become:
printf "d a\na\n\n\n\nRAID\nw\nq\n\n"

we'd maybe need to replace all echo commands with printf. it would at
least be more portable.

jmc

To: <misc@...>
Cc: Matthew Szudzik <mszudzik@...>, <marco@...>
Date: Tuesday, January 29, 2008 - 6:28 am

so i've just made this change...
jmc

To: Matthew Szudzik <mszudzik@...>, <marco@...>, <misc@...>
Date: Monday, January 28, 2008 - 10:13 pm

sure.

Previous thread: Re: mailing list server downtime by Darrin Chandler on Saturday, January 26, 2008 - 11:33 pm. (1 message)

Next thread: Re: mysqld: Error in accept: Bad file descriptor by Takumitsu Itoh on Saturday, January 26, 2008 - 11:07 am. (2 messages)