-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
difference between --with-included-regex and without #2
Comments
From
This is new since I worked on ed for macOS. TRE is a very interesting library; one that I wanted to adopt at one time. But it had many issues compared to GNU regex library when I looked at it . But since you're having better luck than I am linking against macOS regex, I guess I shouldn't advise you against using macOS regex :) To answer your question about the behavioral differences between macOS regex and GNU regex, macOS regex has a compile-time macro, REG_ENHANCED, which ed uses when available. To read more about it, see ENHANCED FEATURES section of The macro REG_ENHANCED occurs in the source file src/re.c. It can be disabled by applying the attached diff. |
I'm unable to get ed to work reliably when linked against macOS regex using either GNU C or Clang. I assume you're using Xcode? If so, I'm curious what version (e.g., the output of |
Tested on
compiled version with and without GNU regex Regards. |
My macOS and Xcode versions are the same as yours. So it appears that the problem is my system, not ed or macOS regex! My previous message was sent prematurely, I don't know if you saw the latest edit: macOS regex has an ENHANCED variant that this version of ed enables which adds C-style literals. So what you're seeing is expected behavior, but it's a POSIX extension not supported by GNU regex. If you don't care for macOS ENHANCED regex, I attached in the message above a patch to disable it. |
Thank you for the corrections. |
So today for macOS you recommend using configure without --with-included-regex but in this case, we return to the old problem :)
I am glad to help. |
No, you are absolutely correct. I think I was distracted by my (initial) inability to link against macOS regex. Anyhow, I agree that basic regular expressions should not be extended in ed. Those extensions are explicitly disabled in GNU regex for that reason. So I've added a patch to disable extensions to basic regular expressions in macOS regex as well. Thank you for your perseverance in bringing this to my attention :) Less clear is how extended regular expressions should be handled, since support for extended regular expressions in ed is already an extension of the POSIX standard. What was intended for GNU is to enable all extensions unless the environment variable POSIXLY_CORRECT exists, in which case POSIX extended regular expressions are used. Likewise, when ed is configured with extended regular expression support and linked against macOS regex library, if extended regular expressions are requested (via option -E or -r), then all extensions are enabled by default. |
Thanks, now but doesn't work |
This matches the POSIX spec.
Even POSIX extended regular expressions do not support C-style literals like \r, so this does NOT match the POSIX spec. Nonetheless most people probably don't want POSIX extended regular expressions, so extensions to POSIX are permitted in this case.
Yeah, the code base needs some attention. I'll update Gnulib and gettext and address some known bugs as time allows. |
Sorry for perseverance If this
|
What I meant to say is that, according to POSIX, that should NOT work. So the current ed behavior is correct. The previous behavior was incorrect. |
The AT&T version of ed recognizes \r? Is that linked against AT&T's regular expressions library? |
Here is the latest official Open Group specification for regular expressions. POSIX standards are collaboration of The Open Group and ISO. You can verify that C-style escape sequences like \r are not part of the standard. |
For reference, GNU sed recognizes \r, even when invoked with the --posix option, which is supposed to disable all GNU extensions. This represents a bug, but illustrates that POSIX standards are often not respected in the open source world. |
Thanks.
In my case |
For the latest version of your ed |
Hm... I'm also seeing some strangeness that I can't fully explain. I ended up hacking the script `missing' to always succeed. I may need to check in with the GNU autoconf folks to get to the bottom of it. In the mean time, try a clean clone of HEAD: git clone https://github.com/slewsys/ed.git
cd ./ed
./configure --disable-nls --enable-all-extensions
make
|
No all the same |
Ed builds and tests okay again on macOS. The script `missing' is still hacked, which needs to be addressed. If you're trying to update a git repository, you may need to first reset to a previous commit: git reset --hard 3972b2f79f17e8a20e9e2d835949135fd9d6cd34
git pull
git clean -fd |
yes, with the exception of old warnings. |
I think the incompatible pointer is the main one? I'll address those as time permits. That the |
No, I mean clang warning like |
HI |
Hi, git clone https://github.com/slewsys/ed.git
cd ./ed
./configure --enable-all-extensions
make Can you provide the commands and environment used to produce the error? Thank you! |
Hi, |
Hi |
I apologize, not yet. The config script doesn't work right for 32-bit ARM either. But in your case, it may be simply a matter of upgrading the GNUlib library. I hope to have some free time, maybe between now and New Year's, to investigate. Thank you for your interest :) |
Hi, In a previous commit, I hacked the script 'missing' for the Darwin platform. The real issue is that To work around this, I've published a source archive: https://github.com/slewsys/ed/releases/download/v2.0.11/ed-2.0.11.gd16bf96.tgz |
Hi if i add required files to lib/malloc |
In theory, GNUlib (that's what is in the lib directory) shouldn't be needed at all. That's only there in case you want to compile against GNU regex. On the other hand, it's also possible that M1 toolchain is missing some functions. In that case, we would need to add more components from GNUlib (presently only regex and supporting functions are included). I'd like to first try removing GNUlib altogether. If the M1 toolchain is indeed missing something, then we can import what's missing from GNUlib as needed. To that end, I've created a new branch without-gnulib. Here is the source archive: https://github.com/slewsys/ed/releases/download/untagged-ebeb10d54a7114b10018/ed-2.0.11-without-gnulib.gfca6591.tgz |
Sorry, I can't download your file but clone without-gnulib
define HAVE_STRERROR in config.h or remove strings from ed.h
|
Maybe this information will be useful |
I think the Gnulib (malloc/dynarray) issues have been sorted out. HEAD of branch main compiles and tests pass on several systems: *BSD, OmniOS, Linux (64-bit and 32-bit ARM) and macOS High Sierra. Perhaps if you can attach config.log from Apple M1, that might help me understand what's going on. |
with and without gnulib |
If looks like configure is using both gcc and clang? Does setting CC envar help? For example: |
CC=clang ./configure --enable-all-extensions [--with-included-regex] |
no effect for ed-without-gnulib, same result like ./configure --enable-all-extensions |
configure ed-without-gnulib on intel transfer source to arm |
Just a heads up: I pushed some patches to the branch without-gnulib and will maintain it until your work-around isn't requierd, maybe with the help of the autoconf group. |
Hi
please check this:
./configure --disable-nls --enable-all-extensions
make
make check
All 137 tests were successful.
printf %s\r\n a b c
printf '%s\n' ',s/\r$//' w q | ed -s file
The ed removes '\r'
make clean
./configure --disable-nls --enable-all-extensions --with-included-regex
make
make check
All 137 tests were successful.
printf %s\r\n a b c
printf '%s\n' ',s/\r$//' w q | ed -s file
In this case, the ed does not delete '\r'
and this
ed.1.gz
Regards.
The text was updated successfully, but these errors were encountered: