Skip to content

mkfifo hangs when file permissions are supplied #2605

@sio

Description

@sio
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?

The problem affects current release of Git for Windows 2.26.2. I've traced it to first appear in 2.26.0-rc1. 2.26.0-rc0 works correctly. All checks were performed on Portable 64-bit Git for Windows from the releases page of this project.

$ git --version --build-options
git version 2.26.0.rc1.windows.1
cpu: x86_64
built from commit: e0fbc270ec0f2baa77884b14555de61565ec2070
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

Windows 10 64-bit

$ cmd.exe /c ver
Microsoft Windows [Version 10.0.18362.30]
  • What options did you set as part of the installation? Or did you choose the
    defaults?

No installation was performed. I use portable release. That's probably the reason files mentioned below do not exist on my machine.

# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

None of these files exist
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I use Russian version of Windows, my Windows username contains Cyrillic letters. That may lead to encoding conversion errors in some cases.

Details

Something is wrong with Msys environment bundled with Git for Windows (versions starting from 2.26.0-rc1 through 2.26.2). This is probably caused by updating mkfifo from coreutils 8.31 to 8.32 in that release. Upstream mkfifo code has not changed since 2016, so the issue may be with how it's built in Git for Windows.

Named pipe creation with mkfifo hangs indefinitely if -m value is provided to specify file permissions. Writing into the named pipe at that moment triggers hanged mkfifo to error out:

mkfifo: cannot set permissions of 'helloworld': Invalid argument
Exit code: 1

Running mkfifo without -m argument succeeds. I've tried to understand the reasons by reading straces, but that's above my level. Here they are:

The differences start around line 500 in failure log.

Line 540 fhandler_pipe::create: pipe write handle NULL is where it hangs until someone tries to write into named pipe.

Failure happens probably here, but I can not decipher it. Lines 540-547

  103   34722 [main] mkfifo 2287 fhandler_pipe::create: pipe write handle NULL
5810129 5844851 [main] mkfifo 2287 fhandler_fifo::open: res 0
  135 5844986 [main] mkfifo 2287 open: 3 = open(helloworld, 0x2148000)
  104 5845090 [main] mkfifo 2287 __set_errno: int fstatat(int, const char*, stat*, int):4808 setting errno 22
   74 5845164 [main] mkfifo 2287 close: close(3)
   93 5845257 [main] mkfifo 2287 fhandler_base::close: closing '/helloworld' handle 0x1CC
   96 5845353 [main] mkfifo 2287 close: 0 = close(3)
 1048 5846401 [main] mkfifo 2287 open: open(/usr/share/locale/locale.alias, 0x0)
$ mkfifo --version
mkfifo (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

git-bash.exe

mkfifo -m 600 helloworld
  • What did you expect to occur after running these commands?

Named pipe should be created and next bash prompt should appear. Exit code $? should be zero.

  • What actually happened instead?

Named pipe is created but mkfifo hangs indefinitely. Upon attempting to write into that pipe (echo abcde > helloworld from another terminal) mkfifo errors out:

mkfifo: cannot set permissions of 'helloworld': Invalid argument
Exit code: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions