Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Supporting all possible paths, is it a goal worth aiming for?

When I was reading the code in the file libcomposefs/lcfs-mount.c, I noticed that
commas are escaped but not the escape character (backslash). Often such code
would also escape the escape character (i.e a backslash), something like this

--- a/libcomposefs/lcfs-mount.c
+++ b/libcomposefs/lcfs-mount.c
@@ -157,7 +157,7 @@ static void escape_mount_option_to(const char
*str, char *dest)

        d = dest + strlen(dest);
        for (s = str; *s != 0; s++) {
-               if (*s == ',')
+               if (*s == ',' || *s == '\\')
                        *d++ = '\\';
                *d++ = *s;
        }
@@ -171,7 +171,7 @@ static char *escape_mount_option(const char *str)
        int n_escapes = 0;

        for (s = str; *s != 0; s++) {
-               if (*s == ',')
+               if (*s == ',' || *s == '\\')
                        n_escapes++;
        }

Anyway, it seems to be a bit tricky to support all possible paths (i.e. the whole "value space" of possible paths for basedir, upperdir and workdir).

I'm bringing up this discussion topic because changes to the user interface are easier to make early in a software project. (I don't need this feature myself)

You must be logged in to vote

Replies: 1 comment · 1 reply

Comment options

You must be logged in to vote
1 reply
@eriksjolund
Comment options

eriksjolund Apr 2, 2024
Collaborator Author

I thought it would be easier for other software projects to integrate with composefs if they could use any path (i.e any possibilities of backslash, colon and comma).
If there would be a complicated escaping scheme for the composefs input parameters, then composefs could help out with some extra command-line tool to convert a path into an escaped path.

This is just my gut feeling. I'm not speaking out of experience here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.