Git: Allowing people to add Msys2 packages please?

Created on 15 Jun 2020  路  19Comments  路  Source: git-for-windows/git

  • [x] 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?
    64-bit.
$ git --version --build-options
git version 2.26.2.windows.1
cpu: x86_64
built from commit: 4267c88d0d8936ae723bba55e0576b1c4f3d4e1a
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running?
    64-bit Microsoft Windows 10 Enterprise
    Version=10.0.18363
$ cmd.exe /c ver
Microsoft Windows [Version 10.0.18363.836]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
> type "C:\Program Files\Git\etc\install-options.txt"
Editor Option: VIM
Custom Editor Path:
Path Option: CmdTools
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

No.

Details

  • Which terminal/shell are you running Git from? Bash

This is not about Git-Bash per se, but Git-Bash allowing people to add Msys2 packages themselves. So I add pacman to Git-Bash myself, and when I try to add further packages, I got:

  • What commands did you run to trigger this issue?
$ pacman -S tmux
resolving dependencies...
looking for conflicting packages...

Packages (8) gcc-libs-9.3.0-1  libevent-2.1.11-2  libopenssl-1.1.1.g-1  msys2-runtime-3.1.4-1  ncurses-6.2-1
            openssl-1.1.1.g-1  zlib-1.2.11-1  tmux-3.1-1

Total Download Size:    9.89 MiB
Total Installed Size:  87.18 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
msys2-runtime-3.1.4-1-x86_64                  3.0 MiB   977 KiB/s 00:03 [#######################################] 100%
gcc-libs-9.3.0-1-x86_64                    1251.9 KiB   977 KiB/s 00:01 [#######################################] 100%
ncurses-6.2-1-x86_64                       1347.3 KiB   980 KiB/s 00:01 [#######################################] 100%
zlib-1.2.11-1-x86_64                         55.1 KiB   545 KiB/s 00:00 [#######################################] 100%
libopenssl-1.1.1.g-1-x86_64                1117.2 KiB  1008 KiB/s 00:01 [#######################################] 100%
openssl-1.1.1.g-1-x86_64                      2.7 MiB   994 KiB/s 00:03 [#######################################] 100%
libevent-2.1.11-2-x86_64                    162.3 KiB   978 KiB/s 00:00 [#######################################] 100%
tmux-3.1-1-x86_64                           306.4 KiB  1053 KiB/s 00:00 [#######################################] 100%
(8/8) checking keys in keyring                                           [#######################################] 100%
(8/8) checking package integrity                                         [#######################################] 100%
(8/8) loading package files                                              [#######################################] 100%
(8/8) checking for file conflicts                                        [#######################################] 100%
error: failed to commit transaction (conflicting files)
msys2-runtime: /usr/bin/chattr.exe exists in filesystem
msys2-runtime: /usr/bin/cygcheck.exe exists in filesystem
msys2-runtime: /usr/bin/cygpath.exe exists in filesystem
msys2-runtime: /usr/bin/cygwin-console-helper.exe exists in filesystem
msys2-runtime: /usr/bin/gencat.exe exists in filesystem
msys2-runtime: /usr/bin/getconf.exe exists in filesystem
msys2-runtime: /usr/bin/getfacl.exe exists in filesystem
msys2-runtime: /usr/bin/kill.exe exists in filesystem
msys2-runtime: /usr/bin/ldd.exe exists in filesystem
msys2-runtime: /usr/bin/ldh.exe exists in filesystem
msys2-runtime: /usr/bin/locale.exe exists in filesystem
msys2-runtime: /usr/bin/lsattr.exe exists in filesystem
msys2-runtime: /usr/bin/minidumper.exe exists in filesystem
msys2-runtime: /usr/bin/mkgroup.exe exists in filesystem
msys2-runtime: /usr/bin/mkpasswd.exe exists in filesystem
msys2-runtime: /usr/bin/mount.exe exists in filesystem
msys2-runtime: /usr/bin/msys-2.0.dll exists in filesystem
msys2-runtime: /usr/bin/passwd.exe exists in filesystem
msys2-runtime: /usr/bin/pldd.exe exists in filesystem
msys2-runtime: /usr/bin/ps.exe exists in filesystem
msys2-runtime: /usr/bin/regtool.exe exists in filesystem
msys2-runtime: /usr/bin/setfacl.exe exists in filesystem
msys2-runtime: /usr/bin/setmetamode.exe exists in filesystem
msys2-runtime: /usr/bin/ssp.exe exists in filesystem
msys2-runtime: /usr/bin/strace.exe exists in filesystem
msys2-runtime: /usr/bin/tzset.exe exists in filesystem
msys2-runtime: /usr/bin/umount.exe exists in filesystem
msys2-runtime: /usr/share/cygwin/cygwin.ldif exists in filesystem
gcc-libs: /usr/bin/msys-atomic-1.dll exists in filesystem
gcc-libs: /usr/bin/msys-gcc_s-seh-1.dll exists in filesystem
gcc-libs: /usr/bin/msys-gomp-1.dll exists in filesystem
gcc-libs: /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION exists in filesystem
ncurses: /usr/bin/captoinfo.exe exists in filesystem
ncurses: /usr/bin/clear.exe exists in filesystem
. . . skipping a whole bunch . . .

  • What did you expect to occur after running these commands?

pacman can successful adding packages. e.g., pacman -S cpio or pacman -S tmux

  • What actually happened instead?

pacman failed with above errors.

According to

"Failed to commit transaction (conflicting files)" error
https://wiki.archlinux.org/index.php/pacman#%22Failed_to_commit_transaction_(conflicting_files)%22_error

Every installed package provides a /var/lib/pacman/local/package-version/files file that contains metadata about this package. If this file gets corrupted, is empty or goes missing, it results in file exists in filesystem errors when trying to update the package.

So I'm thinking please don't delete those /var/lib/pacman/local/package-version/files files when distributing Git-Bash. That'll make people adding Msys2 packages themselves much easier.

Thanks

question

Most helpful comment

I guess the MSYS2 IRC channel on oftc.net, the MSYS2 Gitter Room and the Git for Windows Gitter Room

All 19 comments

You might wanna use the Git for Windows SDK instead.

So I'm thinking please don't delete those /var/lib/pacman/local/package-version/files files when distributing Git-Bash.

AFAIK the issue is slightly more complex because the installed file system contains only some of the files registered by the packages. Adding the /var/lib/... files as suggested would probably just change the issue of unexpected files into an issue of missing files.

The purpose of Git for Windows is really to bring Git to Windows.

While that implies that we have to ship quite a few Unix-like tools, it does not mean that we will include such tools unless they are needed for Git's own operations, or at least for historical reasons (needs of active contributors are sometimes a factor in deciding whether to include a tool or not).

Having said that, what you really are looking for is MSYS2. Git for Windows leverages MSYS2 and ships with a subset of its files. MSYS2 even sports a package management system called "pacman" to install more tools (including Git...), so why don't you give it a whirl?

MSYS2 even sports a package management system called "pacman" to install more tools (including Git...), so why don't you give it a whirl?

As you may have found, I'm already using the pacman in Git for Windows, see my OP for details.
I don't want to use MSYS2 or rather the git within it directly because I'll be losing the Git for Windows' customizations.

... as suggested would probably just change the issue of unexpected files into an issue of missing files.

OK. It's more complex than I thought. Fine, I'll install MSYS2 myself and try to copy those files over myself then.

I'll install MSYS2 myself and try to copy those files over myself then.

This might help: https://github.com/git-for-windows/git/wiki/Install-inside-MSYS2-proper

But please note that my support load is already very high with regular Git for Windows, you should really try to ramp up the expertise to help yourself (and hopefully others, in this here bug tracker).

Thanks Johannes, having checked that, I think it is easy enough for me to give it a try.

Saw someone has successfully make it working, hope I can be the second person endorsing that method...

@dscho

Then synchronize new repository with
pacboy update

I can't make that step works:

$ pacman -S pacboy
error: target not found: pacboy

$ pacman -Ss pacboy
# not found

I tried to use pacman -Sy to synchronize the new repository, but that step doesn't _"updates msys2-runtime"_ and doesn't ask me to close the window.

So I'm stuck there.

BTW, I tweaked the wiki a bit, please review the changes, and hope it's OK with you.

Now I think the _"updates msys2-runtime"_ comes from installing Git for Windows, but that critical step is missing from the wiki.

the _"updates msys2-runtime"_ comes from installing Git for Windows, but that critical step is missing from the wiki.

Hi @suntong, Which wiki page needs updating (and roughly where)

The one Johannes said just previously -- https://github.com/git-for-windows/git/wiki/Install-inside-MSYS2-proper, step 4, @PhilipOakley

It makes the commands a bit shorter, but I'll change the wikipage to use regular Pacman. We removed Pacboy from the base installation recently.

@suntong, next time you're missing a command:

# pacman -Fy
:: Synchronizing package databases...
[...]
# pacman -F pacboy.exe
# pacman -F pacboy
msys/pactoys-git r2.07ca37f-1 (base base-devel)
    usr/bin/pacboy
    usr/share/bash-completion/completions/pacboy

If you need more help with the steps, you can contact me on Gitter or IRC.

Thanks for the kind offer @elieux, how can I find you on Gitter or IRC (I'm not familiar on either of them, :blush: )

I guess the MSYS2 IRC channel on oftc.net, the MSYS2 Gitter Room and the Git for Windows Gitter Room

To make the story full,

  • I went through the above, https://github.com/git-for-windows/git/wiki/Install-inside-MSYS2-proper, successfully to the end, and _"everything works for me"_ at first.
  • Then I installed mingw-w64-x86_64-git-lfs, but git started to ask for my https: password now. I need git-lfs, and I also need git-bash's no-password-asked default behavior, so I have to go back to git-bash again.

_However_, copying /var/lib/pacman/local files over from my msys2 installation into git-bash's, I was able to install tmux (as I planned/showed in OP), and it is working fine for me.

So, having /var/lib/pacman/local files is all it take for msys2 and pacman to work within git-bash (I meant git-for-windows), thus I'm reopening the issue for your reconsideration.

However, I do understand git-for-windows' position, so feel free to close it as your final decision, since I already have my copy of /var/lib/pacman/local files to make things working. thx.

Why was this ticket reopened?

... thus I'm reopening the issue for your reconsideration.

However, I do understand git-for-windows' position, so feel free to close it as your final decision, since I already have my copy of /var/lib/pacman/local files to make things working. thx.

... thus I'm reopening the issue for your reconsideration.

@suntong to spell it out clearly: unless you plan on upping your game and helping with supporting this feature, there is no chance. Don't force me to spend even more time on this when I already told you that I cannot afford the time.

sure.

I agree with the issue raised here. What I did to get a pragmatic setup that works was:

  • Install both GfW and MSYS2 separately.
  • Put C:\Program Files\Git\cmd in the Windows PATH.
  • Use the MSYS2 shell, not Git Bash.
  • Now you have the best of both worlds.

Thanks for your understanding and support @torhovland.
Your approach is much much simpler than the route I took, and much more robust than mine too.
Two thumbs up. Thanks for sharing!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sschlesier picture sschlesier  路  3Comments

kc22033 picture kc22033  路  4Comments

jesterKing picture jesterKing  路  3Comments

Jarmos-san picture Jarmos-san  路  3Comments

JoshSchreuder picture JoshSchreuder  路  4Comments