Skip to content
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

"bus error" on Mac OS with specific test file and regex #1519

Open
fizbin opened this issue Apr 27, 2023 · 1 comment
Open

"bus error" on Mac OS with specific test file and regex #1519

fizbin opened this issue Apr 27, 2023 · 1 comment

Comments

@fizbin
Copy link

fizbin commented Apr 27, 2023

I found this when using ag to scan a whole directory of python source for a particular code pattern, then narrowed down the reproducible case to the smallest section of stuff-that-looks-like-source that I could. I did not attempt to minimize the regex, so you get that in all its original messiness.

Output of uname -a on my machine, with the machine name censored: (It's an Apple M1 Max)

Darwin MachineNameHere 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

Note that ag does not bus error when called with test_file as a second argument; the bus error only happens when it reads it from the directory. (Though since it does bus error when run on the whole original source file explicitly, it's likely that a larger test_file could trigger this even when called with the file as a second argument)

Transcript of error:

% brew upgrade ag
Warning: ag 2.2.0 already installed
% ag --version                                                                                                              
ag version 2.2.0

Features:
  +jit +lzma +zlib
% ls -a -F       
./		../		test_file
% cat test_file                                                                                                             
    WordWith_re_InIt,  # here's a comment with a stray apostrophe
    XXXXXXXXX,  # other comment
)


BLAH_BLAH_BLAH_IS_IT_IMPORTANT_MAYBE: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX = {
    "keyone": ["value1"]
}

DEFAULT_BIG_DICTIONARY_OF_STUFF: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX = {
    "keytwo": ZZZZZZZZZZ.YYYYYYYYYYYYYYYYY,
    "keythree": ZZZZZZZZZZ.YYYYYYYYYYYYYYYYY,
    "keyfour": ZZZZZZZZZZ.YYYYYYYYYYYYYYYYY,
    "keyfive": ZZZZZZZZZZ.YYYYYYYYYYYYYYYYY,
    "keysix": ZZZZZZZZZZ.YYYYYYYYYYYYYYYYY,
% ag 're[^\x27"]*(?:(?:\x27(?:[^\\\x27]|\\.)*\x27|"(?:[^\\"]|\\.)*")[^\x27"]*)*(?:\x27(?:[^\\\x27]|\\.)*|"(?:[^\\"]|\\.)*){'
zsh: bus error  ag 
@fizbin
Copy link
Author

fizbin commented Apr 27, 2023

test_file.txt

Attached is the test file. It gets a bus error no matter what the filename is. (I had to rename the file to test_file.txt to attach it in github)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant