Opened 3 years ago

Closed 3 years ago

#32610 closed Bug (fixed)

django.utils.version.get_git_changeset() always returns None.

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Utilities Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django.utils.version.get_git_changeset() always returns None. It's related with passing shell=True to the subprocess.run() call which results with a help page in git_log.stdout:

usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
...

Regression in a44d80f88e22eda24dacef48e368895ebea96635.

Change History (3)

comment:1 by Mariusz Felisiak, 3 years ago

Has patch: set
Owner: changed from nobody to Mariusz Felisiak
Status: newassigned

comment:2 by Carlton Gibson, 3 years ago

Triage Stage: UnreviewedAccepted

comment:3 by GitHub <noreply@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In cfe47b76:

Fixed #32610 -- Fixed get_git_changeset() on Linux.

shell=True is required on Windows. Unfortunately passing a sequence to
subprocess.run() behaves differently on Linux, i.e. the first item
specifies the command string, and any additional items are treated as
additional arguments to the shell itself.

https://docs.python.org/3.9/library/subprocess.html#subprocess.Popen
https://docs.python.org/3.9/library/subprocess.html#converting-an-argument-sequence-to-a-string-on-windows

Regression in a44d80f88e22eda24dacef48e368895ebea96635.

Note: See TracTickets for help on using tickets.
Back to Top