Google Groups không còn hỗ trợ đăng ký sử dụng hoặc đăng nội dung mới trên Usenet. Bạn vẫn có thể xem nội dung cũ.

ANNOUNCE: DJGPP port of GNU Sed 4.2 uploaded.

17 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Juan Manuel Guerrero

chưa đọc,
18:25:19 7 thg 6, 20097/6/09
đến djgpp-a...@delorie.com
This is a port of GNU Sed 4.2 to MSDOS/DJGPP.


sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
While in some ways similar to an editor which permits scripted edits
(such as ed), sed works by making only one pass over the input(s), and
is consequently more efficient. But it is sed's ability to filter text
in a pipeline which particularly distinguishes it from other types of
editors.

Please, read carefully the NEWS file to see the user visible changes
and read the info or html docs to become familiar with the program.
For beginers the chapter: examples in the info doc may be instructive.
The chapter: Other resources for learning about 'sed' contains pointers
to usefull sed specific urls.

DJGPP specific changes.
=======================

- The input stream is switched to binary mode, if it does not come from the
console, on platforms, like DOS/WIN95, that distinguish between text and
binary files. This will allow to process files that contain embedded ^Z
and lone ^M characters.
- 8+3 valid file names will be generated for backup names of input file names
if only SFN support is available. This concerns the '-i' option (in-place
editing).
- To compile the sources you will need libsupp 6.1 or later. The library
provides a fixed version of popen()/pclose() functions from the libc cvs
tree that will replace those ones that come with djdev204 (2004-11-25).

You will need LFN support to configure and compile the sources. This also
applies to run the testsuite.

As usual, all djgpp specific files (config.bat, diffs, readme files, etc.)
are located in the /djgpp subdir.

Here is an extract of the NEWS file showing the user visible changes from
the last port (sed 4.1.5) to this one:

Sed 4.2

* now released under GPLv3

* added a new extension `z` to clear pattern space even in the presence
of invalid multibyte sequences

* a preexisting GNU gettext installation is needed in order to compile
GNU sed with NLS support

* new option --follow-symlinks, available when editing a file in-place.
This option may not be available on some systems (in this case, the
option will *not* be a no-op; it will be completely unavailable).
In the future, the option may be added as a no-op on systems without
symbolic links at all, since in this case a no-op is effectively
indistinguishable from a correct implementation.

* hold-space is reset between different files in -i and -s modes.

* multibyte processing fixed

* the following GNU extensions are turned off by --posix: options [iImMsSxX]
in the `s' command, address kinds `FIRST~STEP' and `ADDR1,+N' and `ADDR1,~N',
line address 0, `e' or `z' commands, text between an `a' or `c' or `i'
command and the following backslash, arguments to the `l' command.
--posix disables all extensions to regular expressions.

* fixed bug in 'i\' giving a segmentation violation if given alone.

* much improved portability

* much faster in UTF-8 locales

* will correctly replace ACLs when using -i

* will now accept NUL bytes for `.'

----------------------------------------------------------------------------


The port consists of the usual three packages that can be downloaded from
ftp.delorie.com and mirrors as (timestamp 2009-06-07):

Sed 4.2 binary, info and man format documentation:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/sed42b.zip

Sed 4.2 dvi, html, pdf and ps format documentation:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/sed42d.zip

Sed 4.2 source:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/sed42s.zip


For the convenience of the WinXP users the binaries has been produced
a second time using the djdev204 beta library. This package is available
at ftp.delorie.com and mirrors as (timestamp 2009-06-07):

Sed 4.2 binary, info and man format documentation:
ftp://ftp.delorie.com/pub/djgpp/beta/v2gnu/sed42b.zip

Send Sed specific bug reports to <bug-gn...@gnu.org>.
Send suggestions and bug reports concerning the DJGPP port
to comp.os.msdos.djgpp or <dj...@delorie.com>.

Enjoy.

Guerrero, Juan Manuel <juan.g...@igd.fhg.de>

Rugxulo

chưa đọc,
10:48:30 8 thg 6, 20098/6/09
đến
Hi,

On Jun 7, 5:25 pm, "Juan Manuel Guerrero" <juan.guerr...@gmx.de>
wrote:


>
> This is a port of GNU Sed 4.2 to MSDOS/DJGPP.

Yes, you'd mentioned porting this. Big thanks (since sed is very
useful, one of my favorites)!

>   sed is a stream editor. A stream editor is used to perform basic text
>   transformations on an input stream (a file or input from a pipeline).
>   While in some ways similar to an editor which permits scripted edits
>   (such as ed), sed works by making only one pass over the input(s), and
>   is consequently more efficient. But it is sed's ability to filter text
>   in a pipeline which particularly distinguishes it from other types of
>   editors.

Sed actually derived from ed (as did grep), I think. And improved ed
(ex) is what later morphed into vi ("visual") and then VIM. The
advantage to sed (vs. ed) is that you don't have to load the entire
file at once, so sed can edit files larger than memory, one line at a
time. But if your data is on a slow fixed disk, it won't be faster
than in memory (of course). But I'm almost always on a RAM disk
anyways. ;-)

>   Please, read carefully the NEWS file to see the user visible changes
>   and read the info or html docs to become familiar with the program.
>   For beginers the chapter: examples in the info doc may be instructive.
>   The chapter: Other resources for learning about 'sed' contains pointers
>   to usefull sed specific urls.

Some people have gotten hanoi, dc, sokoban, arkanoid, unlambda, etc.
working in sed. :-)

Rugxulo

chưa đọc,
03:32:04 11 thg 7, 200911/7/09
đến
Hi,

On Jun 7, 5:25 pm, "Juan Manuel Guerrero" <juan.guerr...@gmx.de>
wrote:
>

> This is a port of GNU Sed 4.2 to MSDOS/DJGPP.
>

>   Send suggestions and bug reports concerning the DJGPP port
>   to comp.os.msdos.djgpp or <dj...@delorie.com>.

I'm not sure this is technically a bug since it seems to still work as
expected, but I'm mentioning it anyways just FYI. It doesn't do this
(complain) on Windows at all.

------------------------------------------------------------------

[ FreeDOS ] Sat 07/11/2009>cat tony.txt
hello world

[ FreeDOS ] Sat 07/11/2009>d:\utils\sed -i "s/hello/goodbye/" tony.txt
d:/utils/sed.exe: preserving permissions for `./seaaaaaa': Function
not implemen
ted (ENOSYS)

[ FreeDOS ] Sat 07/11/2009>cat tony.txt
goodbye world

===========================================================================

[ DR-DOS ] Sat 7-11-2009>cat tony.txt
hello world

[ DR-DOS ] Sat 7-11-2009>sed -i "s/hello/GOODBYE/" tony.txt
c:/utils/sed.exe: preserving permissions for `./seaaaaaa': Function
not implemen
ted (ENOSYS)

[ DR-DOS ] Sat 7-11-2009>cat tony.txt
GOODBYE world
------------------------------------------------------------------

Andris Pavenis

chưa đọc,
16:44:47 11 thg 7, 200911/7/09
đến dj...@delorie.com
11.07.2009 10:32, Rugxulo kirjoitti:
> Hi,
>
> On Jun 7, 5:25 pm, "Juan Manuel Guerrero"<juan.guerr...@gmx.de>
> wrote:
>> This is a port of GNU Sed 4.2 to MSDOS/DJGPP.
>>
>> Send suggestions and bug reports concerning the DJGPP port
>> to comp.os.msdos.djgpp or<dj...@delorie.com>.
>
> I'm not sure this is technically a bug since it seems to still work as
> expected, but I'm mentioning it anyways just FYI. It doesn't do this
> (complain) on Windows at all.
>
> ------------------------------------------------------------------
>
> [ FreeDOS ] Sat 07/11/2009>cat tony.txt
> hello world
>
> [ FreeDOS ] Sat 07/11/2009>d:\utils\sed -i "s/hello/goodbye/" tony.txt
> d:/utils/sed.exe: preserving permissions for `./seaaaaaa': Function
> not implemen
> ted (ENOSYS)

Does it happens with or without LFN support in FreeDOS?

If with then I suspect that this could be related to absence of implementation
some LFN related DOS call for DJGPP. I sometimes met this when trying to
run configure scripts under FreeDOS (mostly though DOSEMU+FreeDOS).

The solution could be either
- fixing FreeDOS (if DOSEMU is being used then
part of LFN related function should be fixed there)
- providing fallbacks to non LFN calls for FreeDOS (or when related LFN call
results in according error code)

Andris

Rugxulo

chưa đọc,
18:20:35 11 thg 7, 200911/7/09
đến
Hi,

On Jul 11, 3:44 pm, Andris Pavenis <andris.pave...@iki.fi> wrote:
> 11.07.2009 10:32, Rugxulo kirjoitti:
>
> > I'm not sure this is technically a bug since it seems to still work as
> > expected, but I'm mentioning it anyways just FYI. It doesn't do this
> > (complain) on Windows at all.
>

> Does it happens with or without LFN support in FreeDOS?

No LFN drivers were loaded, simply 8.3 SFN default. I tested both
FreeDOS and DR-DOS just to see if it was specific to either one
(apparently not). BTW, 4.1.5 didn't complain. I honestly still never
understood if you thought 4.1.5 was broken (rename) or if that was
just some change in 4.2 due to Gnulib. 4.1.5, even with "-i", always
seemed to work for me (plain DOS, SFNs).

Juan Manuel Guerrero

chưa đọc,
02:24:24 14 thg 7, 200914/7/09
đến
On 11 Jul 2009 00:32:04, "Rugxulo" <rugxulo AT gmail DOT com> wrote:

> Hi,
>
> On Jun 7, 5:25=A0pm, "Juan Manuel Guerrero" <juan DOT guerr DOT DOT DOT AT gmx DOT de>


> wrote:
> >
> > This is a port of GNU Sed 4.2 to MSDOS/DJGPP.
> >

> > =A0 Send suggestions and bug reports concerning the DJGPP port
> > =A0 to comp.os.msdos.djgpp or <dj DOT DOT DOT AT delorie DOT com>.


>
> I'm not sure this is technically a bug since it seems to still work as
> expected, but I'm mentioning it anyways just FYI. It doesn't do this
> (complain) on Windows at all.
>

> ------------------------------------------------------------------
>
> [ FreeDOS ] Sat 07/11/2009>cat tony.txt
> hello world
>
> [ FreeDOS ] Sat 07/11/2009>d:\utils\sed -i "s/hello/goodbye/" tony.txt
> d:/utils/sed.exe: preserving permissions for `./seaaaaaa': Function
> not implemented (ENOSYS)

[snip]


It is certainly not a bug. All 100% MSDOS compatible OS
must produce this error message.
The same happens on Windows if you set LFN=n.

The reason is that the gnulib code defaults to chmod() as
a last resort to change the file permissions. This is the
case with DJGPP. DJGPP's implementation of chmod() calls
INT21 func 0x7143 to get/set file attributes if LFN support
is available and func 0x4300/0x4301 if only SFN support is
available. The -i option works by writing the output into
a temporary file. IIRC sed tries to rename and change file
permissions while the temporary file is still open. This
makes func 0x4300/0x4301 fail in this way. There is
nothing special here. ENOSYS is what Windows/MSDOS always
returns in this case and this is recorded by DJGPP's errno
and passed to the caller. Every MSDOS compatible OS must
implement func 0x4300/0x430 in this way. On a UNIX mashine
the code will never produce error messages because changing
names and permissions is allowed while files are still open.
This issue was already tzreated in thread here.
I was aware about this issue and I tried to suppress this
error message. Unfortunatly the function that calls chmod()
is called by two different functions and I fixed only one
of them and missed the other one.

On 11 Jul 2009 15:20:35, "Rugxulo" <rugxulo AT gmail DOT com> wrote:

[snip]


> BTW, 4.1.5 didn't complain. I honestly still never
> understood if you thought 4.1.5 was broken (rename) or if that was
> just some change in 4.2 due to Gnulib. 4.1.5, even with "-i", always
> seemed to work for me (plain DOS, SFNs).

4.1.5 is over 3.5 years old. In those days they do not use
gnulib so that some of the issues did not rise. The backup
filename generation is certainly broken. If a backup prefix
und suffix is given and only SFN support is available, then
the filename is generated by prepending the prefix and
adding the suffix to the end of the original filename
without checking if it exceeds the 8+3 filename limit.
This name is passed to the DOS function and truncated by
that function. This may work or not. Example: filename is
foobar.txt and -iback_*_up is given as option. Then the
following backup filename is generated: back_foobar.txt_up.
This will be truncated by DOS to back_foo.txt. The suffix
is completely descarted because it does not fit into 3
characters long extension. I have changed this in such a
way that the required amount of characters are removed from
the extension to allow to fit the given suffix. The idea
is to allow for scripts that may produce backups like this
-i*NNN where NNN stands for a backup number. In this case
-i*1 will make a backup filename like this foobar.tx1.
The real difficulties ariesed with the use of gnulib to
replace all the old file handling stuff. The way files
are created, read and written by gnulib and sed is very
UNIX centric without taking into acount that certain
used techniques will only work with POSIX filesystems.
It should be clear that the use of gnulib and the way sed
handles the file operations makes it very difficult to
create a port compiling the sources out-of-the-box.
The reason is quite simple Windows/DOS is not very POSIX
compatible.
May be I will created a new update of the port to suppress
the error message reported.


Regards,
Juan M. Guerrero

Rugxulo

chưa đọc,
18:19:49 25 thg 7, 200925/7/09
đến
Hi,

On Jul 14, 1:24 am, Juan Manuel Guerrero <juan.guerr...@gmx.de> wrote:
> On 11 Jul 2009 00:32:04, "Rugxulo" <rugxulo AT gmail DOT com> wrote:
> > On Jun 7, 5:25=A0pm, "Juan Manuel Guerrero" <juan DOT guerr DOT  DOT  DOT  AT gmx DOT de>
> > wrote:
>
> > > This is a port of GNU Sed 4.2 to MSDOS/DJGPP.
>
> > > =A0 Send suggestions and bug reports concerning the DJGPP port
> > > =A0 to comp.os.msdos.djgpp or <dj DOT  DOT  DOT  AT delorie DOT com>.
>

> It is certainly not a bug.  All 100% MSDOS compatible OS
> must produce this error message.
> The same happens on Windows if you set LFN=n.

Well, here's what I think is an actual real bug since it not only
whines, but it doesn't work, even on Windows (LFN). I tested both
4.1.5 and 4.2, same bug. In my mind, it should work, but for some
reason it doesn't. :-/ It seems to leave a temporary file in
the current dir (a or aaaaa in this case) with what is probably the
failed rename file.

-----------------------------------
[ Vista/DJGPP ] - Sat 07/25/2009 >sed -i -e "/^unsi.* _rdtsc(/s/^/
static /" -e
"s/extern \(__inline__\)/static \1/" /dev/env/DJDIR/include/time.h
c:/armslurp/utils/sed.exe: cannot rename /dev/env/DJDIR/include//
seaaaaaa: Perm
ission denied (EACCES)

[ Vista/DJGPP ] - Sat 07/25/2009 >sed --version | sed 1q
GNU sed version 4.2

[ Vista/DJGPP ] - Sat 07/25/2009 >ls -la /dev/env/DJDIR/include/time.h
-rw-r--r-- 1 Rugxulo root 2859 Feb 15 2003 /dev/env/DJDIR/
include/t
ime.h

[ Vista/DJGPP ] - Sat 07/25/2009 >scrndump sed42.bug
-----------------------------------

My current workaround is this:

sh -c "cd /dev/env/DJDIR/include ; sed -i -e '/^unsi.* _rdtsc(/s/^/
static /' -e 's/extern \(__inline__\)/static \1/' time.h"

0 tin nhắn mới