git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] revision: premature free-and-null causes “unknown option `(null)`”

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
Sep 25, 2026, 00:28 UTC
Message-ID
<74796901-ffb1-4cf3-bd63-7294328f70bc@app.fastmail.com>
(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
Next: Jeff King
Message 1 of 9 in “[BUG] revision: premature free-and-null causes “unknown option `(null)`””
  1. Kristoffer HaugsbakkSep 25, 2026
  2. Jeff KingSep 25, 2026
  3. 0/2 some parse_revision_opt() bugfixesJeff King, Sep 25, 2026
  4. 1/2 revision: avoid reporting known options as unknown on errorJeff King, Sep 25, 2026
  5. 2/2 revision: handle argv movement in parse_revision_opt()Jeff King, Sep 25, 2026
  6. Kristoffer HaugsbakkSep 26, 2026
  7. Jeff KingSep 28, 2026
  8. Kristoffer HaugsbakkSep 29, 2026
  9. Junio C HamanoSep 25, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.