Skip to content

Incompatibility with sed Command on macOS #4

@552020

Description

@552020

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions