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

Avoid using "|" character in naming profile variants #81

Open
cosimolupo opened this issue Nov 29, 2024 · 1 comment
Open

Avoid using "|" character in naming profile variants #81

cosimolupo opened this issue Nov 29, 2024 · 1 comment
Labels
bug formatting improvement of code style and structure

Comments

@cosimolupo
Copy link
Contributor

During the recent EBRAINS Software Distribution (ESD) Hackathon in Heidelberg, a potential weakness of Cobrawap has been pointed out.

As well documented here, for a fixed profile of analysis, different variants can be used, differentiated by using the | character. E.g., for main configuration profile config_some_profile.yaml, we could have two different variants:

  • config_some_profile|variant_1.yaml

  • config_some_profile|variant_2.yaml

Actually, the use of pipes in filenames can be a very likely pitfall, either for what regards filename parsing by external libraries (see the case of neo package), and more in general for filesystem robustness and portability. Also, many expert users may be used to manipulate files through the shell, and having |'s in filenames requires extra efforts for avoiding the interpretation of | as a "concatenate" command.

A possible solution for variants can be the already implemented use of the _ hierarchy in profile naming. So in the example above, the two variants would be:

  • config_some_profile_variant_1.yaml

  • config_some_profile_variant_2.yaml

which already have higher priority with respect to config_some_profile.yaml (exactly as it used to be before).

@cosimolupo cosimolupo added bug formatting improvement of code style and structure labels Nov 29, 2024
@rgutzen
Copy link
Collaborator

rgutzen commented Dec 3, 2024

To note, the | has a functionality different from the _ in the profiling hierarchy:

# search order:
    config_some_profile_name|variant.yaml
    config_some_profile|variant.yaml
    config_some|variant.yaml
    config|variant.yaml
    config_some_profile_name.yaml
    config_some_profile.yaml
    config_some.yaml
    config.yaml

The crux is to choose a character that may not already be used in the path, and because _ has already another function I landed on |. In the pipeline, filenames are automatically quoted to not get in trouble with the bash meaning of characters.
However, let's discuss about a more elegant solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug formatting improvement of code style and structure
Projects
None yet
Development

No branches or pull requests

2 participants