Skip to content

Conversation

hmaarrfk
Copy link
Contributor

@hmaarrfk hmaarrfk commented Oct 10, 2024

Consider the strange strange case that a user wants to start their app through Steam.

And steam provides a 32 bit LDPRELOAD in 2024.

So the output is actually

CompletedProcess(args=['git', 'describe', '--long', '--always', '--tags', '--dirty', '--first-parent'], returncode=0, stdout=b"ERROR: ld.so: object '/home/mark/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.\nv0.5.0-3-g94e5939-dirty\n")

Which then wrecks any access to the version variable.

Korinj knew that these kinds of bugs would happen...

Consider the strange strange case that a user wants to start their app
through Steam.

And steam provides a 32 bit LDPRELOAD in 2024.

So the output is actually
```
CompletedProcess(args=['git', 'describe', '--long', '--always', '--tags', '--dirty', '--first-parent'], returncode=0, stdout=b"ERROR: ld.so: object '/home/mark/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.\nv0.5.0-3-g94e5939-dirty\n")
```

Which then wrecks any access to the version variable.

Korinj knew that these kinds of bugs would happen...
@hmaarrfk hmaarrfk requested a review from Korijn as a code owner October 10, 2024 12:43
Korijn
Korijn previously approved these changes Oct 10, 2024
Copy link
Collaborator

@Korijn Korijn left a comment

Choose a reason for hiding this comment

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

Korinj knew that these kinds of bugs would happen...

😂

@almarklein
Copy link
Member

Probably good to then also show the stderr in the warning message?

@hmaarrfk
Copy link
Contributor Author

Ah in the case of failure. Sure.

@hmaarrfk
Copy link
Contributor Author

Will do

@almarklein
Copy link
Member

Consider the strange strange case that a user wants to start their app through Steam.

I know you're a power-user, but this is next-level shit.

@hmaarrfk
Copy link
Contributor Author

ValveSoftware/steam-for-linux#6718

Just for reference

@hmaarrfk
Copy link
Contributor Author

In [1]: from pygfx._version import repo_dir
Could not get pygfx version.

stdout:

stderr: error: unknown option `foo'
usage: git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]
   or: git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]
   or: git describe <blob>

    --[no-]contains       find the tag that comes after the commit
    --[no-]debug          debug search strategy on stderr
    --[no-]all            use any ref
    --[no-]tags           use any tag, even unannotated
    --[no-]long           always use long format
    --[no-]first-parent   only follow first parent
    --[no-]abbrev[=<n>]   use <n> digits to display object names
    --[no-]exact-match    only output exact matches
    --[no-]candidates <n> consider <n> most recent tags (default: 10)
    --[no-]match <pattern>
                          only consider tags matching <pattern>
    --[no-]exclude <pattern>
                          do not consider tags matching <pattern>
    --[no-]always         show abbreviated commit object as fallback
    --[no-]dirty[=<mark>] append <mark> on dirty working tree (default: "-dirty")
    --[no-]broken[=<mark>]
                          append <mark> on broken working tree (default: "-broken")

Please feel free to suggest and edit the formatting

Also handling in the case that you have errors in the subprocess command:

In [1]: import pygfx
Could not get pygfx version: [Errno 2] No such file or directory: 'gitthatdoesneixt'

In [2]:

(of course, i had to simulate the errors by editing the source....)

@hmaarrfk
Copy link
Contributor Author

Consider the strange strange case that a user wants to start their app through Steam.

I know you're a power-user, but this is next-level shit.

I honestly couldn’t really believe the failure mode myself.

I have been using git describe tricks for 6 years plus…..

@almarklein almarklein merged commit d6d4271 into pygfx:main Oct 12, 2024
14 checks passed
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.

3 participants