From: Bodo Eggert <harvested.in.lkml@7eggert.dyndns.org>
To: "Bernd Petrovitsch" <bernd@firmix.at>,
"Martin v. Löwis" <martin@v.loewis.de>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [Patch] Support UTF-8 scripts
Date: Sun, 18 Sep 2005 21:23:42 +0200 [thread overview]
Message-ID: <E1EH4lL-0001Iz-Lx@be1.lrz> (raw)
In-Reply-To: <4O8Oh-5jp-7@gated-at.bofh.it>
Bernd Petrovitsch <bernd@firmix.at> wrote:
> On Sun, 2005-09-18 at 09:23 +0200, "Martin v. Löwis" wrote:
> [...]
>> >>Hmm. What does that have to do with the patch I'm proposing? This
>> >>patch does *not* interfere with all text files. It is only relevant
>> >>for executable files starting with the #! magic.
>> >
>> > It *does* interfere since scripts are also text files in every aspect.
>> > So every feature you want for "scripts" you also get for text files (and
>> > vice versa BTW).
>>
>> The specific feature I get is that when I pass a file starting
>> with <utf8sig>#! to execve, Linux will execute the file following
>> the #!. In what way do I get this feature for text in general?
>> And if I do, why is that a problem?
>
> After applying this patch it seems that "Linux" is supporting this
> marker officially in general - especially if the kernel supports it.
It will be the first POSIX kernel to correctly support utf-8 scripts.
It's 2005, and according to other(?) posters, this should be standard.
> I
> suppose the next kernel patch is to support Win-like CR-LF sequences
> (which is not the case AFAIK).
Maybe it should, maybe it shouldn't. If I used MAC or DOS, I'd be sure it
should.-)
> BTW even some standards body thinks that this is the way to go,
Not surprisingly the Unicode Consortium is one of them.
> it
> raises more problems and questions than resolves anything.
The problem of ow to handle BOM is solved by reading the standard.
> And though scripts are usually edited/changed/"parsed"/... with an text
> editor, it is not always the case. Therefore the automatic extension to
> *all text files* (especially as the marker basically applies to all text
> files, not only scripts).
> You want to focus just on your patch and ignore the directly implied
> potential problems arising ...
There is no problem arising from the patch, it solves one.
To solve the rest, use recode.
[...]
> Apparently I have to repeat: If you do `cat a.txt b.txt >c.txt` where
> a.txt and b.txt have this marker, then c.txt have the marker of b.txt
> somewhere in the middle. Does this make sense in anyway?
> How do I get rid of the marker in the middle transparently?
The unicode standard defines how to handle them.
>> > Let alone the confusion why the size of a file with `ls -l` is different
>> > from the size in the editor or a marker-aware `wc -c`.
>>
>> This is true for any UTF-8 file, or any multibyte encoding. For any
>> multibyte encoding, the number of bytes in the file is different from
>> the number of characters. That doesn't (and shouldn't) stop people from
>> using multi-byte encodings.
>
> It is different even if a pure ASCII file is marked as UTF-8.
No pure ASCII file will be marked, since a marked file will be no
ASCII file.
> And sure, the problem exists in general with multi-byte encodings.
ACK, but that's not a kernel problem nor a specific unicode problem.
Fix it by making China, Greece an Japan convert to ASCII and by making
all mathematicans stop using strange characters. All other users will
follow.
>> What the editor displays as the number of "things" is up to its own.
>> The output of wc -c will always be the same as the one of ls -l,
>> as wc -c does *not* give you characters:
>>
>> -c, --bytes
>> print the byte counts
>>
>> You might have been thinking of 'wc -m'.
>
> It depends on the definition of "character". There are other standards
> which define "character" as "byte".
There are architectures defining a byte to be 32 bit.
They are irrelevant, too.
[...]
>> Not sure what this has
>> to do with the specific patch, though.
>
> It is not supported by the kernel. So either you remove it or you make
> some compatibility hack (like an appropriate sym-link
-EDOESNOTWORK
#!/usr/bin/perl -T -s -w
>, etc.). Since the
> kernel can start java classes directly, you can probably make a similar
> thing for the UTF-8 stuff.
If MSDOS text files are text files are legal scripts, the kernel
should recognize [\x0D\x0A] as valid line breaks.
(The real reason would be unicode allowing NEL to be encoded as 0x0D
or 0x0A.)
This compile-tested patch adds 32 bytes to binfmt_script:
--- ./fs/binfmt_script.c.old 2005-09-18 20:28:32.000000000 +0200
+++ ./fs/binfmt_script.c 2005-09-18 20:29:44.000000000 +0200
@@ -18,7 +18,7 @@
static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
{
- char *cp, *i_name, *i_arg;
+ char *cp, *cp2, *i_name, *i_arg;
struct file *file;
char interp[BINPRM_BUF_SIZE];
int retval;
@@ -47,6 +47,9 @@ static int load_script(struct linux_binp
bprm->buf[BINPRM_BUF_SIZE - 1] = '\0';
if ((cp = strchr(bprm->buf, '\n')) == NULL)
cp = bprm->buf+BINPRM_BUF_SIZE-1;
+ if ((cp2 = strchr(bprm->buf, '\x0D')) != NULL
+ && cp2 < cp)
+ cp = cp2;
*cp = '\0';
while (cp > bprm->buf) {
cp--;
--
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
next prev parent reply other threads:[~2005-09-18 19:24 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4Nvab-7o5-11@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-13@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-15@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-17@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-19@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-21@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-23@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-25@gated-at.bofh.it>
[not found] ` <4Nvab-7o5-27@gated-at.bofh.it>
[not found] ` <4NvjM-7CU-7@gated-at.bofh.it>
[not found] ` <4NvjM-7CU-5@gated-at.bofh.it>
[not found] ` <4NxbR-20S-1@gated-at.bofh.it>
[not found] ` <4NEn7-3M5-7@gated-at.bofh.it>
[not found] ` <4NTvO-yJ-13@gated-at.bofh.it>
2005-09-18 0:53 ` Bodo Eggert
2005-09-18 16:53 ` Bernd Petrovitsch
[not found] ` <4O1MJ-3Hf-5@gated-at.bofh.it>
[not found] ` <4O8Oh-5jp-7@gated-at.bofh.it>
2005-09-18 19:23 ` Bodo Eggert [this message]
2005-09-18 21:03 ` Bernd Petrovitsch
2005-09-19 19:37 ` Bodo Eggert
2005-09-18 22:29 ` Valdis.Kletnieks
2005-09-19 6:03 ` H. Peter Anvin
2005-09-19 4:54 ` "Martin v. Löwis"
2005-09-19 8:26 ` Bernd Petrovitsch
2005-09-19 9:00 ` Valdis.Kletnieks
2005-09-19 9:41 ` Bernd Petrovitsch
2005-09-19 21:40 ` "Martin v. Löwis"
[not found] <4NVHm-3yE-13@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-15@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-17@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-19@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-21@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-23@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-25@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-27@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-29@gated-at.bofh.it>
[not found] ` <4NVHm-3yE-31@gated-at.bofh.it>
[not found] ` <4NVHn-3yE-33@gated-at.bofh.it>
[not found] ` <4NVHn-3yE-35@gated-at.bofh.it>
[not found] ` <4NVHn-3yE-37@gated-at.bofh.it>
[not found] ` <4NVHn-3yE-39@gated-at.bofh.it>
[not found] ` <4Od1x-3e3-5@gated-at.bofh.it>
[not found] ` <4Od1x-3e3-7@gated-at.bofh.it>
[not found] ` <4Od1w-3e3-3@gated-at.bofh.it>
[not found] ` <4OfZo-7AG-21@gated-at.bofh.it>
2005-09-19 5:11 ` "Martin v. Löwis"
[not found] <4NsP0-3YF-11@gated-at.bofh.it>
[not found] ` <4NsP0-3YF-13@gated-at.bofh.it>
[not found] ` <4NsP0-3YF-15@gated-at.bofh.it>
[not found] ` <4NsP0-3YF-17@gated-at.bofh.it>
[not found] ` <4NsP1-3YF-19@gated-at.bofh.it>
[not found] ` <4NsP1-3YF-21@gated-at.bofh.it>
[not found] ` <4NsOZ-3YF-9@gated-at.bofh.it>
[not found] ` <4NsYH-4bv-27@gated-at.bofh.it>
[not found] ` <4NtBr-4WU-3@gated-at.bofh.it>
[not found] ` <4NtL0-5lQ-13@gated-at.bofh.it>
2005-09-16 20:34 ` "Martin v. Löwis"
2005-09-17 12:01 ` Martin Mares
2005-09-17 12:25 ` "Martin v. Löwis"
2005-09-17 12:28 ` Martin Mares
2005-09-17 12:53 ` "Martin v. Löwis"
2005-09-17 13:05 ` Martin Mares
2005-09-17 13:33 ` "Martin v. Löwis"
2005-09-19 7:08 ` Pavel Machek
2005-09-19 7:18 ` "Martin v. Löwis"
2005-09-19 7:24 ` Pavel Machek
2005-09-19 7:46 ` "Martin v. Löwis"
2005-09-19 7:50 ` Pavel Machek
2005-09-19 10:48 ` Alan Cox
2005-09-19 23:49 ` Horst von Brand
[not found] ` <4Nu4p-5Js-3@gated-at.bofh.it>
2005-09-16 20:41 ` "Martin v. Löwis"
2005-09-16 22:08 ` H. Peter Anvin
2005-09-17 6:05 ` "Martin v. Löwis"
2005-09-16 22:45 ` Bernd Petrovitsch
2005-09-17 6:20 ` "Martin v. Löwis"
2005-09-17 22:28 ` Bernd Petrovitsch
2005-09-18 7:23 ` "Martin v. Löwis"
2005-09-18 14:50 ` Bernd Petrovitsch
2005-09-17 6:45 ` "Martin v. Löwis"
[not found] ` <4NXfZ-5P0-1@gated-at.bofh.it>
[not found] ` <4NYlM-7i0-5@gated-at.bofh.it>
[not found] ` <4Olip-6HH-13@gated-at.bofh.it>
2005-09-19 4:41 ` "Martin v. Löwis"
[not found] <4N6EL-4Hq-3@gated-at.bofh.it>
[not found] ` <4N6EL-4Hq-5@gated-at.bofh.it>
[not found] ` <4N6EK-4Hq-1@gated-at.bofh.it>
[not found] ` <4N6EX-4Hq-27@gated-at.bofh.it>
[not found] ` <4N6Ox-4Ts-33@gated-at.bofh.it>
[not found] ` <4N7AS-67L-3@gated-at.bofh.it>
2005-09-16 18:02 ` Bodo Eggert
2005-09-16 18:09 ` H. Peter Anvin
2005-09-16 18:57 ` Bodo Eggert
2005-09-16 19:08 ` Martin Mares
2005-09-16 19:25 ` H. Peter Anvin
2005-09-16 19:57 ` Horst von Brand
[not found] ` <200509170028.59973.dhazelton@enter.net>
2005-09-17 6:28 ` "Martin v. Löwis"
2005-09-17 22:31 ` D. Hazelton
2005-09-18 3:45 ` Kyle Moffett
2005-09-19 0:14 ` D. Hazelton
2005-09-18 6:58 ` "Martin v. Löwis"
2005-09-19 0:31 ` D. Hazelton
2005-09-17 17:16 ` Bodo Eggert
[not found] <4B2ZV-2dl-7@gated-at.bofh.it>
[not found] ` <4HKbZ-Cx-37@gated-at.bofh.it>
2005-09-15 18:24 ` "Martin v. Löwis"
2005-09-15 18:25 ` H. Peter Anvin
2005-09-15 18:39 ` "Martin v. Löwis"
2005-09-15 19:20 ` H. Peter Anvin
2005-09-16 8:13 ` Bernd Petrovitsch
2005-08-13 12:07 "Martin v. Löwis"
2005-08-13 16:35 ` Stephen Pollei
2005-08-13 18:42 ` Lee Revell
2005-08-13 18:49 ` Hugo Mills
2005-08-13 18:53 ` Lee Revell
2005-08-14 0:57 ` Alan Cox
2005-08-14 1:19 ` Kyle Moffett
2005-08-14 1:40 ` Lee Revell
2005-08-14 10:40 ` Wichert Akkerman
2005-08-13 19:20 ` Lee Revell
2005-08-16 9:46 ` Jan Engelhardt
2005-08-14 0:53 ` Alan Cox
2005-08-14 4:10 ` James Cloos
2005-08-14 6:18 ` Jason L Tibbitts III
[not found] ` <feed8cdd050814125845fe4e2e@mail.gmail.com>
2005-08-14 19:59 ` Lee Revell
2005-08-14 20:13 ` Stephen Pollei
2005-08-14 20:22 ` Lee Revell
2005-08-14 22:10 ` "Martin v. Löwis"
2005-08-14 23:55 ` Alan Cox
2005-08-16 13:56 ` David Madore
[not found] ` <mailman.1124063520.13257.linux-kernel2news@redhat.com>
2005-08-16 20:17 ` Pete Zaitcev
2005-08-14 21:52 ` Kyle Moffett
2005-08-14 22:12 ` Valdis.Kletnieks
2005-08-15 8:01 ` Helge Hafting
2005-08-31 23:27 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1EH4lL-0001Iz-Lx@be1.lrz \
--to=harvested.in.lkml@7eggert.dyndns.org \
--cc=7eggert@gmx.de \
--cc=bernd@firmix.at \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@v.loewis.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®