public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug releng/31703] New: Git detection false positive when 'which' not available
@ 2024-05-05 21:22 thaines.astro at gmail dot com
  2024-05-06  7:04 ` [Bug releng/31703] " sam at gentoo dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: thaines.astro at gmail dot com @ 2024-05-05 21:22 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=31703

            Bug ID: 31703
           Summary: Git detection false positive when 'which' not
                    available
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: releng
          Assignee: systemtap at sourceware dot org
          Reporter: thaines.astro at gmail dot com
  Target Milestone: ---

The fedora containers don't have 'which' installed by default:

  $ docker run --rm fedora:39 which
  docker: Error response from daemon:
    failed to create task for container:
    failed to create shim task:
    OCI runtime create failed:
    runc create failed:
    unable to start container process: exec: "which":
    executable file not found in $PATH: unknown.

The check in git_version.sh notices the failure, but doesn't exit early.

git_found=yes
if [ "x$GIT" = "xgit" ] && [ x`which $GIT 2>/dev/null` = "x" ]; then
    git_found="'$GIT' not found"
    break
fi

I _think_ the solution here is to 'exit' instead of 'break'. Thoughts?

Thanks.
- Tim

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug releng/31703] Git detection false positive when 'which' not available
  2024-05-05 21:22 [Bug releng/31703] New: Git detection false positive when 'which' not available thaines.astro at gmail dot com
@ 2024-05-06  7:04 ` sam at gentoo dot org
  2024-05-06 14:29 ` fche at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sam at gentoo dot org @ 2024-05-06  7:04 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=31703

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

--- Comment #1 from Sam James <sam at gentoo dot org> ---
It should really use command -v instead too :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug releng/31703] Git detection false positive when 'which' not available
  2024-05-05 21:22 [Bug releng/31703] New: Git detection false positive when 'which' not available thaines.astro at gmail dot com
  2024-05-06  7:04 ` [Bug releng/31703] " sam at gentoo dot org
@ 2024-05-06 14:29 ` fche at redhat dot com
  2024-05-06 15:11 ` thaines.astro at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fche at redhat dot com @ 2024-05-06 14:29 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=31703

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> ---
I'm tempted not to diverge unnecessarily from upstream versions
of git_version.sh just because of a buildroot nit like this one.
(One can't expect to build systemtap with a minimal fedora container.)

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug releng/31703] Git detection false positive when 'which' not available
  2024-05-05 21:22 [Bug releng/31703] New: Git detection false positive when 'which' not available thaines.astro at gmail dot com
  2024-05-06  7:04 ` [Bug releng/31703] " sam at gentoo dot org
  2024-05-06 14:29 ` fche at redhat dot com
@ 2024-05-06 15:11 ` thaines.astro at gmail dot com
  2024-05-06 15:35 ` fche at redhat dot com
  2024-05-06 15:38 ` fche at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: thaines.astro at gmail dot com @ 2024-05-06 15:11 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=31703

--- Comment #3 from Tim Haines <thaines.astro at gmail dot com> ---
It wasn't a completely minimal container. I was just showing that there is no
'which' installed by default. My actual workflow is

  $ docker run -it fedora:39

  yum install -y binutils-devel boost-devel clang cmake libdwarf-devel
elfutils-devel gcc g++ git glibc-static libomp libstdc++-static tbb-devel git
python3 json-c-devel m4 autoconf dh-autoreconf gettext
  /* install Dyninst */
  git clone --depth=1 https://sourceware.org/git/systemtap.git
  cd systemtap
  autoreconf
  mkdir build
  cd build
  ../configure --with-dyninst --without-python3-probes
  make -j2

which gives the surprising error

    In file included from ../session.cxx:25:
    ../session.cxx: In member function ‘std::string
systemtap_session::version_string()’:
    ../version.h:10:66: error: ‘GIT_PRETTY_REV’ was not declared in this scope
       10 |   (STAP_EXTRA_VERSION[0] ? GIT_MESSAGE ", " STAP_EXTRA_VERSION :
GIT_PRETTY_REV)
          |                                                                 
^~~~~~~~~~~~~~
    ../session.cxx:503:62: note: in expansion of macro ‘STAP_EXTENDED_VERSION’
      503 |   return string (VERSION) + "/" + elfutils_version2 + ", " +
STAP_EXTENDED_VERSION;
          |                                                             
^~~~~~~~~~~~~~~~~~~~~

The cause here is that git_version.sh generates an inconsistent state in
'git_version.h'.

  /* whether this is a dist tarball or not */
  #undef GIT_IS_DIST

  /* No errors occured while running git */
  #undef GIT_ERRORS

  /* git utilities not found */
  #define GIT_NOT_FOUND "'git' not found"
  #undef GIT_VERSION

  /* git repo found */
  #define GIT_REPO 1

which causes the error in version.h because GIT_REPO is defined, but
GIT_PRETTY_REV isn't despite the thorough error checking in git_version.sh.
It's just that the first error check "failed successfully". The fix for my
workflow is just to install 'which', but getting to that information was not
driven by error messages.

To be certain, I am sure the overwhelming majority of systemtap users aren't
using it through a container. I ran into this problem in a CI workflow where
from-scratch containers are being used.

For my future reference, do folks prefer seeing the full root-cause analysis in
bug reports? I was trying to keep it succinct.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug releng/31703] Git detection false positive when 'which' not available
  2024-05-05 21:22 [Bug releng/31703] New: Git detection false positive when 'which' not available thaines.astro at gmail dot com
                   ` (2 preceding siblings ...)
  2024-05-06 15:11 ` thaines.astro at gmail dot com
@ 2024-05-06 15:35 ` fche at redhat dot com
  2024-05-06 15:38 ` fche at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fche at redhat dot com @ 2024-05-06 15:35 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=31703

--- Comment #4 from Frank Ch. Eigler <fche at redhat dot com> ---
Full RCA in a bugzilla is godsend, thanks.

It seems like installing

# dnf build-dep systemtap.spec
# dnf -y install rpm-build

is also not enough to will /usr/bin/which into existence, sigh.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug releng/31703] Git detection false positive when 'which' not available
  2024-05-05 21:22 [Bug releng/31703] New: Git detection false positive when 'which' not available thaines.astro at gmail dot com
                   ` (3 preceding siblings ...)
  2024-05-06 15:35 ` fche at redhat dot com
@ 2024-05-06 15:38 ` fche at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fche at redhat dot com @ 2024-05-06 15:38 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=31703

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Frank Ch. Eigler <fche at redhat dot com> ---
commit f66e74de9f05

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-06 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-05 21:22 [Bug releng/31703] New: Git detection false positive when 'which' not available thaines.astro at gmail dot com
2024-05-06  7:04 ` [Bug releng/31703] " sam at gentoo dot org
2024-05-06 14:29 ` fche at redhat dot com
2024-05-06 15:11 ` thaines.astro at gmail dot com
2024-05-06 15:35 ` fche at redhat dot com
2024-05-06 15:38 ` fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).