Git: Bug in column utility with ANSI chars, missing EOL

Created on 30 Aug 2016  Â·  7Comments  Â·  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? 32-bit or 64-bit? Include the
    output of git version as well.

    _2.9.0.windows.1_

    $ git --version
    git version 2.9.0.windows.1
    
  • Which version of Windows are you running? 32-bit or 64-bit?

    _Windows 10 Pro 64-bit (10.0.14393)_

  • What options did you set as part of the installation? Or did you choose the
    defaults?

    _Defaults_

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

    _PortableGit installed by GitHub Desktop_

    Details

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

    _Bash_

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

    c0='\033[0m'
    c1='\033[31m'
    c2='\033[32m'
    c3='\033[34m'
    
    text="\
    1 \
    lorem \
    ipsum \
    ${c1}dolor${c0} \
    ${c2}sit${c0} \
    ${c3}amet${c0} \
    
    2 \
    consectetur \
    adipisicing \
    ${c1}elit${c0} \
    ${c2}sed${c0} \
    ${c3}do${c0} \
    
    3 \
    eiusmod \
    tempor \
    ${c1}incididunt${c0} \
    ${c2}ut${c0} \
    ${c3}labore${c0} \
    
    4 \
    et \
    dolore \
    ${c1}magna${c0} \
    ${c2}aliqua${c0} \
    ${c3}ut${c0} \
    
    5 \
    enim \
    ad \
    ${c1}minim${c0} \
    ${c2}veniam${c0} \
    ${c3}quis${c0} \
    
    6 \
    nostrud \
    exercitation \
    ${c1}ullamco${c0} \
    ${c2}laboris${c0} \
    ${c3}nisi${c0} \
    
    7 \
    ut \
    aliquip \
    ${c1}ex${c0} \
    ${c2}ea${c0} \
    ${c3}commodo${c0} \
    
    8 \
    consequat \
    duis \
    ${c1}aute${c0} \
    ${c2}irure${c0} \
    ${c3}dolor${c0} \
    
    9 \
    in \
    reprehenderit \
    ${c1}in${c0} \
    ${c2}voluptate${c0} \
    ${c3}velit${c0} \
    
    10 \
    esse \
    cillum \
    ${c1}dolore${c0} \
    ${c2}eu${c0} \
    ${c3}fugiat${c0} \
    "
    
    printf "$text" | column -t
    
  • What did you expect to occur after running these commands?

    _Columns should line up properly; "line too long" error (row 10 missing EOL)_

    ubuntu
    — Bash on Ubuntu on Windows

  • What actually happened instead?

    _Columnn alignment lost after ANSI escape chars; row 10 displayed_

    windows
    — Bash on Windows

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

    _N/A_

wontfix

All 7 comments

For what it's worth, Msys and Cygwin both display the same behaviour. I don't think this is an issue with Git for Windows per se... should probably be chased down on the Msys side instead.

@dliuzzi indeed, the column.exe utility (which is in package util-linux-2.26.2-1 according to pacman -Qo /usr/bin/column.exe in Git for Windows' SDK) comes from MSYS2, as suggested by @landstander668.

So a better place would be to report this at https://github.com/Alexpux/MSYS2-packages. Brownie points for a Pull Request over there ;-)

I've cloned the repo and looked everywhere. For the life of me, I couldn't even find where column is within the file structure. I need to eat more cereal! 😄 I reported the issue on MSYS2. We'll see where this goes.

Thank you @landstander668 and @dscho for the heads up.

I've cloned the repo and looked everywhere.

The best way to go and do something about the bug in question is to first rebuild the util-linux package from scratch. To that end:

  1. Download and install the Git for Windows SDK,
  2. Make sure that you have everything needed to build packages by calling pacman -Sy base-devel msys2-devel in the SDK window,
  3. Follow the instructions how to rebuild Pacman packages on our Wiki, in your particular case:

    1. call C:\git-sdk-64\msys2_shell.cmd -msys (adjust the path if you installed the 32-bit SDK, or chose a different path than the suggested one),

    2. cd /usr/src/MSYS2-packages

    3. git fetch

    4. git checkout master

    5. cd util-linux

    6. makepkg -s

You will notice that there is a src/util-linux* directory inside /usr/src/MSYS2-packages/util-linux/ now, and that is where the source code lives. You should be able to rebuild the source code by switching to that directory and calling make. (If not, just call ./configure and then make, that should do the trick.)

Hey @dscho That's a great write up to help me get started. Thanks a lot for that. I'll follow your instructions and play with the code. Hopefully I can come up with a fix. Gotta get those brownie points! :-)

@dliuzzi any news?

@dscho I gave it a shot, but this project is extremely foreign to me. That, added to time constraints on my end led to me being unable to do much at all. Sorry about that. Rest assured I will keep you posted if I can come up with something. Thank you again for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelblyons picture michaelblyons  Â·  5Comments

vocaviking picture vocaviking  Â·  5Comments

dscho picture dscho  Â·  3Comments

Jarmos-san picture Jarmos-san  Â·  3Comments

t-b picture t-b  Â·  4Comments