[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#490605: debian-policy: please discourage the usage of echo -n, and echo in general



Raphael Geissert wrote:
> On Tuesday 02 June 2009 12:54:00 Bill Allombert wrote:
> [...]
>> It does not make sense to policy to discourage "echo -n". Policy
>> could deprecate it in favor of something else, but I do not see
>> any alternative mentioned in this bug report, and otherwise
>> discouraging "echo -n" would amount to discourage shell scripts to display
>> lines that does not end by a newline, while Policy 9.4. mandates that init
>> scripts display "Starting foo" without an ending newline.
>> Furthermore, adding vague recommendation to policy is a waste of resource.
>>
>> So, is there an alternative to "echo -n" that you would like to recommends,
>> and are you willing to do the job to make sure that all "Debian
>> sh"-compliant shells in Debian support it ?

I think we could forbid "echo -n" on maintainer and other scripts, but allow it
on init.d scripts.
Rationale:
- portability is more important on other scripts, and it is also not so
  frequent to use echo -n
- init.d are system scripts which special requirement, so they are not
  portable. And we could ev. workaround with a special alias/path
  which set a non-portable echo. This is also simple because
  init.d scripts sould be called only by/via few programs/

> Yes, printf.

It is not an alternative:
- It is ugly
- it is not on root partition

The ugly part it is IMHO the most important part.
Most of people understand "echo -n", but I don't know if all people understand
fully printf.  Mixing echo and printf is ugly.


Anyway the standard are helper tools, not tools to make difficult the live of
user and maintainer. See for example the recent discussion about ext3,
see the old discussion about tar (tar is not in POSIX, people should use
'pax')


BTW I think this is incorrect:
$ POSIXLY_CORRECT=1 bash -c "echo -n line one; echo line two";
> line oneline two


ciao
	cate



Reply to: