Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-07 Thread Florian Festi
Merged #2945 into master. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2945#event-12040967941 You are receiving this because you are subscribed to this thread. Message ID: ___ Rpm-maint

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-07 Thread Panu Matilainen
@pmatilai approved this pull request. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2945#pullrequestreview-1922147413 You are receiving this because you are subscribed to this thread. Message ID:

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-07 Thread Florian Festi
@ffesti pushed 2 commits. 77d02b7e2300f40079f893514b3cd15b8a605e0c Use dirname (3) for %dirname eb2d628e4005a777ff02f693f483691d6d0b00aa Use basename (3) for the %basename macro -- View it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Panu Matilainen
Maybe the basename() case should also have some more advanced tests than the one that is there to match the added dirname cases, see @mlschroe's link. Other than that, looks fine now. -- Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -1306,9 +1307,9 @@ static void doFoo(rpmMacroBuf mb, rpmMacroEntry me, > ARGV_t argv, size_t *parsed) b++; } else if (rstreq("dirname", me->name)) { buf = xstrdup(argv[1]); - if ((b = strrchr(buf, '/')) != NULL) -

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Florian Festi
@ffesti commented on this pull request. > @@ -1306,9 +1307,9 @@ static void doFoo(rpmMacroBuf mb, rpmMacroEntry me, > ARGV_t argv, size_t *parsed) b++; } else if (rstreq("dirname", me->name)) { buf = xstrdup(argv[1]); - if ((b = strrchr(buf, '/')) != NULL) -

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (!strcmp(buf, "")) { + buf = rstrcat(, "."); + } else if (strcmp(buf, ".") && strcmp(buf, "..") && strcmp(buf, "/")) { + /* strip trailing / */ + size_t l = strlen(buf); + if (buf[l-1] == '/') +

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -1306,9 +1307,9 @@ static void doFoo(rpmMacroBuf mb, rpmMacroEntry me, > ARGV_t argv, size_t *parsed) b++; } else if (rstreq("dirname", me->name)) { buf = xstrdup(argv[1]); - if ((b = strrchr(buf, '/')) != NULL) -

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Michael Schroeder
See https://pubs.opengroup.org/onlinepubs/9699919799/functions/basename.html for testcases ;-) -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2945#issuecomment-1978695068 You are receiving this because you are subscribed to this thread.

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Panu Matilainen
Right, I don't know why these aren't calling the respective stdlib functions to begin with. It's not like it's expensive or anything. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2945#issuecomment-1978694251 You are receiving this

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Florian Festi
@ffesti commented on this pull request. > + if (!strcmp(buf, "")) { + buf = rstrcat(, "."); + } else if (strcmp(buf, ".") && strcmp(buf, "..") && strcmp(buf, "/")) { + /* strip trailing / */ + size_t l = strlen(buf); + if (buf[l-1] == '/') +

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Florian Festi
@ffesti pushed 1 commit. 225f33d2c833a186ba46af75d9aed3e50ada1ec6 Use dirname (3) instead of our own code -- View it on GitHub: https://github.com/rpm-software-management/rpm/pull/2945/files/cbff9947298bc694be5b7b1b3a3745bff844ce03..225f33d2c833a186ba46af75d9aed3e50ada1ec6 You are receiving

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Michael Schroeder
If you strip trailing slashes you also have to do it for %basename -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/2945#issuecomment-1978685964 You are receiving this because you are subscribed to this thread. Message ID:

Re: [Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (!strcmp(buf, "")) { + buf = rstrcat(, "."); + } else if (strcmp(buf, ".") && strcmp(buf, "..") && strcmp(buf, "/")) { + /* strip trailing / */ + size_t l = strlen(buf); + if (buf[l-1] == '/') +

[Rpm-maint] [rpm-software-management/rpm] Make %dirname behave like dirname (3) (PR #2945)

2024-03-05 Thread Florian Festi
Strip trailing / Keep . and .. untouched Keep root dir for files in the root dir Return . for files without directory and empty strings See man 3 dirname Resolves: 2928 You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/2945 --