Re: FSFE-defined coding standards?

2021-02-10 Thread Eike Rathke
Hi,

On Monday, 2021-02-08 10:56:43 +, Jacob Hrbek wrote:

> Should FSFE provide some kind of platform for community to discuss and 
> propose coding standards?

Before discussing coding standards we should rule out bad Mail User
Agents that produce totally unusable text/plain from text/html in their
multipart/alternative:

> Bad code:
> 
> #!/bin/bash
> 
> number=
> 
> "5"
> 
> if
> 
> [[
> 
> "
> 
> $number
> 
> "
> 
> =~ [0-9] ]];
> 
> then
> 
> whatever;
> 
> fi
> 
> - Works only on systems with dynamic linking
> - Bash is not part of standard portable OS → Not portable
> 
> Good code:
> 
> #!/bin/sh
> 
> # shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017
> [](http://get.posixcertified.ieee.org/)
> number=
> 
> "5"
> 
> case
> 
> "
> 
> $number
> 
> "
> 
> in
> 
> [0-9]) whatever;
> 
> esac


As sent, both are bad code.

  Eike

-- 
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/


signature.asc
Description: PGP signature
___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct


Re: FSFE-defined coding standards?

2021-02-10 Thread kreyren
On 2/9/21 10:40 PM, Eike Rathke wrote:
> Hi,
>
> On Monday, 2021-02-08 10:56:43 +, Jacob Hrbek wrote:
>
>> Should FSFE provide some kind of platform for community to discuss and 
>> propose coding standards?
> Before discussing coding standards we should rule out bad Mail User
> Agents that produce totally unusable text/plain from text/html in their
> multipart/alternative:
>
>> Bad code:
>>
>> #!/bin/bash
>>
>> number=
>>
>> "5"
>>
>> if
>>
>> [[
>>
>> "
>>
>> $number
>>
>> "
>>
>> =~ [0-9] ]];
>>
>> then
>>
>> whatever;
>>
>> fi
>>
>> - Works only on systems with dynamic linking
>> - Bash is not part of standard portable OS → Not portable
>>
>> Good code:
>>
>> #!/bin/sh
>>
>> # shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017
>> [](http://get.posixcertified.ieee.org/)
>> number=
>>
>> "5"
>>
>> case
>>
>> "
>>
>> $number
>>
>> "
>>
>> in
>>
>> [0-9]) whatever;
>>
>> esac
>
> As sent, both are bad code.
>
>Eike
>
> --
> OpenPGP/GnuPG encrypted mail preferred in all private communication.
> GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 
> 2D3A
> Use LibreOffice! https://www.libreoffice.org/
> ___
> Discussion mailing list
> Discussion@lists.fsfe.org
> https://lists.fsfe.org/mailman/listinfo/discussion
>
> This mailing list is covered by the FSFE's Code of Conduct. All
> participants are kindly asked to be excellent to each other:
> https://fsfe.org/about/codeofconduct

Justify bad code and elaborate on bad mail user agents.

-- 
- Krey



OpenPGP_0x31AE4020956E0A9A.asc
Description: application/pgp-keys


OpenPGP_signature
Description: PGP signature
___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct


Re: FSFE-defined coding standards?

2021-02-10 Thread Valerio Bellizzomi
On Tue, 2021-02-09 at 22:40 +0100, Eike Rathke wrote:
> Hi,
> 
> On Monday, 2021-02-08 10:56:43 +, Jacob Hrbek wrote:
> 
> > Should FSFE provide some kind of platform for community to discuss
> > and propose coding standards?
> 
> Before discussing coding standards we should rule out bad Mail User
> Agents that produce totally unusable text/plain from text/html in
> their
> multipart/alternative:

I don't consider those Mail User Agents as bad, producing text/plain
from text/html is a security feature in some mail clients, for example
in Evolution.


> > Bad code:
> > 
> > #!/bin/bash
> > 
> > number=
> > 
> > "5"
> > 
> > if
> > 
> > [[
> > 
> > "
> > 
> > $number
> > 
> > "
> > 
> > =~ [0-9] ]];
> > 
> > then
> > 
> > whatever;
> > 
> > fi
> > 
> > - Works only on systems with dynamic linking
> > - Bash is not part of standard portable OS → Not portable
> > 
> > Good code:
> > 
> > #!/bin/sh
> > 
> > # shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017
> > [<
> > http://get.posixcertified.ieee.org/>](http://get.posixcertified.ieee.org/
> > )
> > number=
> > 
> > "5"
> > 
> > case
> > 
> > "
> > 
> > $number
> > 
> > "
> > 
> > in
> > 
> > [0-9]) whatever;
> > 
> > esac
> 
> As sent, both are bad code.
> 
>   Eike
> 
> ___
> Discussion mailing list
> Discussion@lists.fsfe.org
> https://lists.fsfe.org/mailman/listinfo/discussion
> 
> This mailing list is covered by the FSFE's Code of Conduct. All
> participants are kindly asked to be excellent to each other:
> https://fsfe.org/about/codeofconduct

___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct


Re: FSFE-defined coding standards?

2021-02-10 Thread Eike Rathke
Hi Valerio,

On Wednesday, 2021-02-10 09:13:35 +0100, Valerio Bellizzomi wrote:

> On Tue, 2021-02-09 at 22:40 +0100, Eike Rathke wrote:
> > Before discussing coding standards we should rule out bad Mail User
> > Agents that produce totally unusable text/plain from text/html in
> > their
> > multipart/alternative:
> 
> I don't consider those Mail User Agents as bad, producing text/plain
> from text/html is a security feature in some mail clients, for example
> in Evolution.

You misunderstood. I didn't say that text/plain is a bad thing, but the
text/plain that your MUA generated for the text/html is catastrophic,
resulting in unlegible and even wrong "source code" for people who do
not use HTML mailers.

  Eike

-- 
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/


signature.asc
Description: PGP signature
___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct


Re: FSFE-defined coding standards?

2021-02-10 Thread Eike Rathke
Hi kreyren,

On Wednesday, 2021-02-10 08:46:15 +, krey...@rixotstudio.cz wrote:

> Justify bad code and elaborate on bad mail user agents.

No. But if these produce text I can't read and cripple "source code" to
be discussed there's no incentive to even follow a discussion.

  Eike

-- 
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/


signature.asc
Description: PGP signature
___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct


Re: FSFE-defined coding standards?

2021-02-10 Thread Alessandro Rubini
Hello.

I don't think FSFE should provide coding standard: everybody is
already doing that. Some coding standard make no sense, some are ugly,
some are good; you only need to choose yours -- or be forced by your
employer.

The problem your describe is that of bashisms.  I agree we should use
/bin/sh in published scripts (and ensure our own sh is not some
featureful derivation).

This applies to all extensions: any extension is not portable by
default, using it before it becomes ubiquitous is going to cause
problems, sooner or later.  But this position is not the most
fashionable nowadays. You can fight this battle, and loose it.

Thanks for remininding about the issue, I recently had proplems with
a mate's bashisms and small embedded systems.

/alessandro
___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct


Re: FSFE-defined coding standards?

2021-02-10 Thread Michael Kesper
Hi all,

Am 10.02.21 um 13:10 schrieb Alessandro Rubini:
> The problem your describe is that of bashisms.  I agree we should use
> /bin/sh in published scripts (and ensure our own sh is not some
> featureful derivation).

I think one should not publish any shell scripts any more except for
the most trivial cases.

Shell code just is hard to read, not portable between systems at all,
has very bad error handling, is hard to impossible to test, in short
unmaintainable. This gets even worse if you use only POSIX features.

My 2 cents
Michael



OpenPGP_signature
Description: OpenPGP digital signature
___
Discussion mailing list
Discussion@lists.fsfe.org
https://lists.fsfe.org/mailman/listinfo/discussion

This mailing list is covered by the FSFE's Code of Conduct. All
participants are kindly asked to be excellent to each other:
https://fsfe.org/about/codeofconduct