Skip to content
Snippets Groups Projects

wayland-info: unbreak build on FreeBSD

Merged Jan Beich requested to merge (removed):freebsd into main

Continuation of ofourdan/wayland-info!2 (closed).

program_invocation_short_name is specific to Linux (many libc except bionic) while getprogname() exists on Android, DragonFly, FreeBSD, NetBSD, OpenBSD, macOS, Solaris.

See also https://android.googlesource.com/platform/system/core/+/platform-tools-30.0.3/liblog/logger_write.cpp#112

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Olivier Fourdan
  • Also, the commit message would need to be more explicit, instead of the bare compiler error.

    I reckon http://who-t.blogspot.com/2009/12/on-commit-messages.html is a good start.

  • Jan Beich added 2 commits

    added 2 commits

    • 82e70a80 - meson: check if program_invocation_short_name is available
    • 4b872315 - wayland-info: disable Linux-only clocks on non-Linux

    Compare with previous version

  • Jan Beich added 2 commits

    added 2 commits

    • 74b6f1b0 - build: use getprogname() on BSDs and Solaris
    • 9109aa9f - wayland-info: disable Linux-only clocks on non-Linux

    Compare with previous version

  • Jan Beich resolved all threads

    resolved all threads

    • Author Contributor

      the commit message would need to be more explicit, instead of the bare compiler error.

      But compiler error is more explicit than human interpretation.

      http://who-t.blogspot.com/2009/12/on-commit-messages.html

      Why is it necessary? See the compiler error.
      How does it address the issue? Read the short diff or the summary.
      What effects does the patch have? Nop elsewhere (Linux). musl has program_invocation_short_name just like glibc.

    • I hope you don't mind me dissecting into this.

      For example, I would have formatted the commit message as something like this:

      build: use getprogname() on BSDs and Solaris
      
      The libc on BSD and Solaris do not implement program_invocation_short_name,
      leading to this error:
      
      ../wayland-info/wayland-info.c:258:28: error: use of undeclared identifier 'program_invocation_short_name'
                      fprintf(stderr, "[%s] ", program_invocation_short_name);
                                               ^
      
      Use getprogname() always if it is found, redefining program_invocation_short_name.

      It's kind of obvious, yes, but it does discriminate from e.g. not using the right #includes by saying the variable does not exist at all.

      Actually, the commit title is a little misleading: you're not testing for BSD and Solaris, you're testing for the existence of getprogname(). So the title should be: build: redefine program_invocation_short_name if getprogname() exists or something in that direction. In that case it is even more important to mention the relevant OSs and the particular OS where you got the error in the commit message, so that readers know why this change was made (as opposed to thinking "I never got that error, why is this patch there?"). This is quite important if someone has a system that has both getprogname() and program_invocation_short_name in which case the #define in config.h might cause compiler errors in system headers.

    • Author Contributor
      build: use getprogname() on BSDs and Solaris
      
      The libc on BSD and Solaris do not implement program_invocation_short_name,
      leading to this error:

      Too verbose: paraphrasing summary line and error message. One-liner here is enough but I admit mine wasn't very good.

      you're not testing for BSD and Solaris, you're testing for the existence of getprogname().

      The reader is supposed to connect the dots between the error message and BSD + Solaris. Every word in the commit message is should carry additional meaning.

      build: redefine program_invocation_short_name if getprogname() exists

      Poor example: the diff is neither large nor complex enough to require translating.

      it is even more important to mention the relevant OSs

      Already mentioned. Reminds me, this is a good example for inline comments.

      and the particular OS where you got the error in the commit message

      Look at my email address in the commit message. ;)

    • I do stand by my comment.

    • Me too. Please think of this like coding style: we all have our preferences, but in a large community project, fitting in with the accepted norm is much more important than your personal preference winning out every time.

    • Agreed, me too.

      FWIW, speaking for myself, I contribute to quite a lot of different projects, with different code base, and having a nice and readable git commit log is not just for being pedantic or to look fancy, it is a real plus for anybody who needs to contribute to the project, either now or in a few years time when nobody remembers what this was all about.

      Edited by Olivier Fourdan
    • Please register or sign in to reply
  • Olivier Fourdan
  • Jan Beich added 2 commits

    added 2 commits

    • 508d64c6 - build: allow missing program_invocation_short_name
    • 844e2447 - wayland-info: disable Linux-only clocks on non-Linux

    Compare with previous version

  • Jan Beich added 2 commits

    added 2 commits

    • 10f85bd4 - wayland-info: allow missing program_invocation_short_name or BSD alias
    • 24e5ad1d - wayland-info: disable Linux-only clocks on non-Linux

    Compare with previous version

  • Daniel Stone changed target branch from master to main

    changed target branch from master to main

  • Simon Ser
  • Jan Beich added 4 commits

    added 4 commits

    • 5b897c93 - NOTE! Default branch is now main
    • 6edadee8 - Merge branch 'master-is-dead-long-live-main' into 'master'
    • 0c13cb92 - wayland-info: hardcode program name in fail_on_null
    • 819236c9 - wayland-info: disable Linux-only clocks on non-Linux

    Compare with previous version

  • Jan Beich added 6 commits

    added 6 commits

    • 819236c9...4d68681d - 4 commits from branch wayland:main
    • 4035a330 - wayland-info: hardcode program name in fail_on_null
    • 82f63675 - wayland-info: disable Linux-only clocks on non-Linux

    Compare with previous version

  • Jan Beich added 1 commit

    added 1 commit

    • 191e3674 - wayland-info: disable Linux-only clocks if not available

    Compare with previous version

  • Author Contributor

    FWIW, an old version of this MR is already used by OpenBSD, not just DragonFly and FreeBSD.

  • This looks good to me!

    • @jbeich, can you add S-o-b tags to your commit messages?

    • Author Contributor

      Done. This repo has no CONTRIBUTING.md and some commits don't have Signed-off-by. In the larger FOSS ecosystem Signed-off-by tags are rare (CLA is a bit more popular). I'm on FreeBSD, so Linux kernel conventions are foreign to me. ;)

    • Right, we should probably mention that this project follows the same conventions as the Wayland repo.

    • Please register or sign in to reply
  • Jan Beich added 2 commits

    added 2 commits

    • df59f76b - wayland-info: hardcode program name in fail_on_null
    • 48e01d63 - wayland-info: disable Linux-only clocks if not available

    Compare with previous version

  • Simon Ser added 3 commits

    added 3 commits

    • 31e03a1d - 1 commit from branch wayland:main
    • 215ea070 - wayland-info: hardcode program name in fail_on_null
    • b359cd2c - wayland-info: disable Linux-only clocks if not available

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading