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

Incompatibility with sed Command on macOS #4

Open
552020 opened this issue Jul 30, 2023 · 1 comment
Open

Incompatibility with sed Command on macOS #4

552020 opened this issue Jul 30, 2023 · 1 comment

Comments

@552020
Copy link

552020 commented Jul 30, 2023

The codebase contains a sed command that doesn't work uniformly across different operating systems, specifically GNU/Linux and macOS. The incompatibility leads to an error message:

sed: 1: "tmp/errorBash.tmp": undefined label 'mp/errorBash.tmp'

The line in question is in src/test.c, line 108

system("sed -i 's/bash/pipex/g' tmp/errorBash.tmp");

On macOS, the syntax for in-place editing with sed requires an additional argument to specify the file extension for backups.

I fixed it with

system("sed -i '' 's/bash/pipex/g' tmp/errorBash.tmp");

A possible fix would to use preprocessor directives to detect the operating system at compile time and choose the correct syntax accordingly. If I run the test in francinette everything works smoothly.

@gmarcha
Copy link
Owner

gmarcha commented Aug 13, 2023

Thank you very much for your report. Pull request are very welcomed.

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

2 participants