Skip to content

builder-flatpak-utils: Normalize the single trailing slash in pattern#677

Open
bbhtt wants to merge 2 commits intomainfrom
bbhtt/normalise-trailing-slash
Open

builder-flatpak-utils: Normalize the single trailing slash in pattern#677
bbhtt wants to merge 2 commits intomainfrom
bbhtt/normalise-trailing-slash

Conversation

@bbhtt
Copy link
Copy Markdown
Contributor

@bbhtt bbhtt commented Sep 23, 2025

Fixes #476

@bbhtt bbhtt force-pushed the bbhtt/normalise-trailing-slash branch from ced12ee to 029ee89 Compare September 23, 2025 13:53
@bbhtt bbhtt requested a review from TingPing February 25, 2026 03:29
@bbhtt bbhtt added this to the 1.5.0 milestone Mar 9, 2026
@bbhtt bbhtt force-pushed the bbhtt/normalise-trailing-slash branch from 029ee89 to 196eb82 Compare April 2, 2026 11:47
@bbhtt
Copy link
Copy Markdown
Contributor Author

bbhtt commented Apr 2, 2026

any comments on this?

Comment on lines 164 to 167
case 0:
if (*string == '/' || *string == 0)
return string;
return NULL;
Copy link
Copy Markdown
Contributor

@swick swick Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handles the inverse. Could add something like

case '/':
  if (*string == '/')
    string++;
  else if (*string != 0)
    return NULL;
  break;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that does not work directly

Copy link
Copy Markdown
Contributor Author

@bbhtt bbhtt Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had to do this, but this copies case 0 again.

case '/':
  if (*pattern == 0)
    {
      /* treat as directory boundary, don't consume */
      if (*string == '/' || *string == 0)
        return string;
      return NULL;
    }
  if (*string == '/')
    string++;
  else if (*string != 0)
    return NULL;
  break;

@swick
Copy link
Copy Markdown
Contributor

swick commented Apr 2, 2026

Not sure if I would consider this a bug in the first place. Kind of depends on what you consider a path prefix I guess.

@bbhtt
Copy link
Copy Markdown
Contributor Author

bbhtt commented Apr 3, 2026

according to the man, patterns are taken to be either the full pathname or basename, not normalising is a bit weird. it also accepts /*. the patterns are also path-like syntactically.

@bbhtt bbhtt force-pushed the bbhtt/normalise-trailing-slash branch from 196eb82 to 47d8312 Compare April 3, 2026 01:06
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

Successfully merging this pull request may close these issues.

[Bug]: cleanup directive in manifest does not delete directories ending with /

2 participants