Git development
 help / color / mirror / Atom feed
* [BUG] revision: premature free-and-null causes “unknown option `(null)`”
@ 2026-09-25  0:28 Kristoffer Haugsbakk
  2026-09-25  8:26 ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2026-09-25  0:28 UTC (permalink / raw)
  To: git; +Cc: Jeff King

(the subject is my preliminary speculation)

     Thank you for filling out a Git bug report!
     Please answer the following questions to help us understand your
     issue.

     What did you do before the bug happened? (Steps to reproduce your
     issue)

```
git shortlog -n --not-an-option master
```

Note that you need a real option like `-n` before the
`--not-an-option`. Or else it will work correctly.

    What did you expect to happen? (Expected behavior)

This error:

```
error: unknown option `--not-an-option'
[usage printout]
```

    What happened instead? (Actual behavior)

This error:

```
error: unknown option `(null)'
[usage printout]
```

    What's different between what you expected and what actually
    happened?

I expected it to print the option in quotes. Instead it printed `(null)`
which I think is the placeholder for when the `%s` arg is `NULL`.

    Anything else you want to add:

I have tested and reproduced on:

• master: 0f8e75ab (Revert "Merge branch
  'en/no-amend-during-conflicts'", 2026-09-23)
• seen: e844e042 (Merge branch 'je/doc-merge-conflicts' into seen,
  2026-09-24)
• next: d58861e6 (Revert "Merge branch 'gg/http-ssl-verify-status' into
  next", 2026-09-23)

I have bisected this to cd439487 (revision: manage memory ownership of
argv in setup_revisions(), 2025-09-19).

Note that the recent topic jk/rev-info-argv-to-free fixes issues caused
by commit cd439487, but that topic does not change how this option
handling behaves; the topic is part of `master` now which I tested. I
also tested on top of the topic and got the same `(null)' result.

    Please review the rest of the bug report below.
    You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.55.0.793.gc667de3f2c5
cpu: x86_64
built from commit: c667de3f2c5e43830a8dfaa79a27d5d1f106f0ab
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: enabled
feature: fsmonitor--daemon
gettext: enabled
libcurl: 7.81.0
OpenSSL: OpenSSL 3.0.2 15 Mar 2022
zlib: 1.2.11
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1
uname: Linux 6.8.0-138-generic #138~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  7 13:43:15 UTC  x86_64
compiler info: gnuc: 11.4
libc info: glibc: 2.35
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
commit-msg
post-applypatch
post-checkout
post-commit
sendemail-validate

-- 
  Kristoffer Haugsbakk
  kristofferhaugsbakk@fastmail.com

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

end of thread, other threads:[~2026-09-29  7:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-25  0:28 [BUG] revision: premature free-and-null causes “unknown option `(null)`” Kristoffer Haugsbakk
2026-09-25  8:26 ` Jeff King
2026-09-25 20:33   ` [PATCH 0/2] some parse_revision_opt() bugfixes Jeff King
2026-09-25 20:35     ` [PATCH 1/2] revision: avoid reporting known options as unknown on error Jeff King
2026-09-25 20:39     ` [PATCH 2/2] revision: handle argv movement in parse_revision_opt() Jeff King
2026-09-26  9:00       ` Kristoffer Haugsbakk
2026-09-28  3:25         ` Jeff King
2026-09-29  7:43           ` Kristoffer Haugsbakk
2026-09-25 22:23     ` [PATCH 0/2] some parse_revision_opt() bugfixes Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox