Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

column -s X -t fails when there are colour escapes before X #252

Closed
voidus opened this issue Jan 10, 2016 · 3 comments
Closed

column -s X -t fails when there are colour escapes before X #252

voidus opened this issue Jan 10, 2016 · 3 comments

Comments

@voidus
Copy link

voidus commented Jan 10, 2016

To Reproduce:

test='\033[33mb\033[mXFoo\n\033[33mbar\033[mXFoo'
echo -e $test
echo '=>'
echo -e $test | column -s X -t

Expected:

bXFoo
barXFoo
=>
b    Foo
bar  Foo

Actual:

bXFoo
barXFoo
=>
b   Foo
bar   Foo

I'm not quite sure how the escapes should be correctly handled. Colours and other formatting should obviously be stripped, but other escapes could necessitate other handling.

The column from bsdmainutils available in debian does not have this problem. I'm on arch using util-linux 2.27.

I already opened issues on bugzilla.kernel.org [1] and on bugs.archlinux.org [2].

[1] https://bugzilla.kernel.org/show_bug.cgi?id=108521
[2] https://bugs.archlinux.org/task/47240#comment141431

@karelzak
Copy link
Collaborator

What version of the command do you have in Debian? Is it another implementation or old version from util-linux?

@voidus
Copy link
Author

voidus commented Jan 12, 2016

Ah, sorry about that. Looks like the debian version I tested is actually the bsd version, it's from bsdmainutils-9.0.6

karelzak added a commit that referenced this issue Jan 13, 2016
echo -e '\033[33mb\033[mXFoo\n\033[33mbar\033[mXFoo' | column -s X -t

old version:

	b   Foo
	bar   Foo

fixed version:

	b    Foo
	bar  Foo

References: #252
Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzak
Copy link
Collaborator

Fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants