git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 'git status -z' missing separators on OSX
@ 2015-06-16 23:21 Tad Hardesty
  2015-06-17  3:32 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Tad Hardesty @ 2015-06-16 23:21 UTC (permalink / raw)
  To: git

I have been experiencing a problem where git on OSX prints incorrect
output to the `git status -z` command, where instead of NUL separators
records are simply not separated. This is causing problems with IDE
integration. While I have a workaround involving manually replacing \n
with \0, it would be nice to identify and fix the root issue.

Here's a terminal session showing the problem:
~$ mkdir test && cd test
~/test$ git init
Initialized empty Git repository in /Users/thardesty/test/.git/
~/test (master #)$ touch a b
~/test (master #)$ ls
a b
~/test (master #)$ git status -z | hexdump -C
00000000  3f 3f 20 61 3f 3f 20 62                           |?? a?? b|
00000008
~/test (master #)$ git add a b
~/test (master #)$ git status -z | hexdump -C
00000000  41 20 20 61 41 20 20 62                           |A  aA  b|
00000008
~/test (master #)$ git status --porcelain | hexdump -C
00000000  41 20 20 61 0a 41 20 20  62 0a                    |A  a.A  b.|
0000000a
~/test (master #)$ git --version
git version 2.4.3
~/test (master #)$ uname -a
Darwin HA002070 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05
PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

As shown, --porcelain prints a newline but -z yields no separator at all.

The Mac is running OS X Yosemite 10.10.3. I have tried git 2.3.2 from
Apple, git 2.4.2 from brew, and git 2.4.3 from brew, git-scm.org, and
self-compiled, and these all exhibit the problem. Some helpful folks on
the #git IRC tried the commands for me and didn't see any problems, but
I temporarily blanked all my configuration files and that didn't help. I
double-checked and git on Linux has the correct behavior.

Thanks for any help.

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

* Re: 'git status -z' missing separators on OSX
  2015-06-16 23:21 Tad Hardesty
@ 2015-06-17  3:32 ` Jeff King
  2015-06-17 21:32   ` Eric Sunshine
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2015-06-17  3:32 UTC (permalink / raw)
  To: Tad Hardesty; +Cc: git

On Tue, Jun 16, 2015 at 06:21:56PM -0500, Tad Hardesty wrote:

> ~/test (master #)$ git status -z | hexdump -C
> 00000000  41 20 20 61 41 20 20 62                           |A  aA  b|
> 00000008

That's really weird. I don't have a Yosemite box available, but I can't
reproduce on the Mavericks box I have access to. Still, I'd suspect
something weird in your config (e.g., something that is inserting itself
on the output pipe of "git status").

You said you blanked your config, but can you do "git config --list"
to double-check? Also, try running with GIT_TRACE=1, which would show if
git is starting a pager between your processes which might be eating the
NUL.

Can you also double-check that you have no aliases for "git" (try "type
git"). We have sometimes seen weird behavior when people have aliased
"git" to "hub".

Is it only "git status" that is affected? Does "git log --oneline -1 -z"
end in a NUL (it should)?

-Peff

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

* Re: 'git status -z' missing separators on OSX
@ 2015-06-17 14:07 Tad Hardesty
  2015-06-17 19:17 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Tad Hardesty @ 2015-06-17 14:07 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Tad Hardesty

Everything looks normal using the commands you described, and it does appear to only affect status:

~/test (master)$ type git
git is hashed (/usr/local/bin/git)
~/test (master)$ git config --list
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
~/test (master)$ GIT_TRACE=1 git status -z
08:59:11.806197 git.c:348               trace: built-in: git 'status' '-z'
~/test (master)$ git log --oneline -1 -z | hexdump -C
00000000  35 31 35 39 30 65 30 20  49 6e 69 74 69 61 6c 20  |51590e0 Initial |
00000010  63 6f 6d 6d 69 74 2e 00                           |commit..|
00000018
~/test (master)$ touch c d
~/test (master)$ git status -z | hexdump -C
00000000  3f 3f 20 63 3f 3f 20 64                           |?? c?? d|
00000008

This is again with 2.4.3 from git-scm.com.

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

* Re: 'git status -z' missing separators on OSX
  2015-06-17 14:07 'git status -z' missing separators on OSX Tad Hardesty
@ 2015-06-17 19:17 ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2015-06-17 19:17 UTC (permalink / raw)
  To: Tad Hardesty; +Cc: git, Tad Hardesty

On Wed, Jun 17, 2015 at 09:07:36AM -0500, Tad Hardesty wrote:

> Everything looks normal using the commands you described, and it does appear to only affect status:
> 
> ~/test (master)$ type git
> git is hashed (/usr/local/bin/git)
> ~/test (master)$ git config --list
> core.repositoryformatversion=0
> core.filemode=true
> core.bare=false
> core.logallrefupdates=true
> core.ignorecase=true
> core.precomposeunicode=true
> ~/test (master)$ GIT_TRACE=1 git status -z
> 08:59:11.806197 git.c:348               trace: built-in: git 'status' '-z'
> ~/test (master)$ git log --oneline -1 -z | hexdump -C
> 00000000  35 31 35 39 30 65 30 20  49 6e 69 74 69 61 6c 20  |51590e0 Initial |
> 00000010  63 6f 6d 6d 69 74 2e 00                           |commit..|
> 00000018
> ~/test (master)$ touch c d
> ~/test (master)$ git status -z | hexdump -C
> 00000000  3f 3f 20 63 3f 3f 20 64                           |?? c?? d|
> 00000008
> 
> This is again with 2.4.3 from git-scm.com.

Hmph. I don't really have any more ideas, then. I think my next step
would be to walk it through a debugger (the interesting function is
wt_shortstatus_status, or wt_shortstatus_other).

-Peff

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

* Re: 'git status -z' missing separators on OSX
  2015-06-17  3:32 ` Jeff King
@ 2015-06-17 21:32   ` Eric Sunshine
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Sunshine @ 2015-06-17 21:32 UTC (permalink / raw)
  To: Jeff King; +Cc: Tad Hardesty, Git List

On Tue, Jun 16, 2015 at 11:32 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Jun 16, 2015 at 06:21:56PM -0500, Tad Hardesty wrote:
>> ~/test (master #)$ git status -z | hexdump -C
>> 00000000  41 20 20 61 41 20 20 62                           |A  aA  b|
>> 00000008
>
> That's really weird. I don't have a Yosemite box available, but I can't
> reproduce on the Mavericks box I have access to. Still, I'd suspect
> something weird in your config (e.g., something that is inserting itself
> on the output pipe of "git status").

I also am unable to reproduce this behavior (using Yosemite).
\b

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

end of thread, other threads:[~2015-06-17 21:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 14:07 'git status -z' missing separators on OSX Tad Hardesty
2015-06-17 19:17 ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2015-06-16 23:21 Tad Hardesty
2015-06-17  3:32 ` Jeff King
2015-06-17 21:32   ` Eric Sunshine

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 NNTP newsgroup(s).