Harmful LESS flags

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Harmful LESS flags

From: <hidden>
Date: 2016-06-15 23:00:48

hello list,

as mentioned earlier on IRC, I'm a bit concerned about the default LESS flags
used by git.

The S option causes git to cut off everything to the right

Consider this diff, printed by `git diff`

	 #!/usr/bin/env python
	-print('foo')
	+print('bar')

Looks ok to merge and run.

But, after disabling the pager:

	 #!/usr/bin/env python
	-print('foo')
	+print('bar') [lots of tabs] ; import os; os.system('aptitude install
subversion')

Oh no!

My workflow is to clone a project, read the whole source and review all diffs
after fetching them. After that is done I merge origin into my local
branch and
run the code on my system.

I've panic'd a bit after I've noticed the chopping.

It would be nice if we could change the flags to either

 a) avoid cutting off
 b) indicate something has been cut off (<- I prefer this)

I assume there are more people with a similar workflow who're still
unaware of
this feature.

I would joke about how 3 letter agencies introduced this flag to backdoor
open
source projects, but, well..

	Sincerely yours,
	a git user

Re: Harmful LESS flags

From: Jonathan Nieder <hidden>
Date: 2016-06-15 23:00:48

(cc-ing Mark Nudelman, less maintainer)
Hi,

d9ba@mailtor.net wrote:
Consider this diff, printed by `git diff`

	 #!/usr/bin/env python
	-print('foo')
	+print('bar')

Looks ok to merge and run.

But, after disabling the pager:
Unfortunately there are other kinds of subtle bugs that can be hard to
see in a terminal, too.

[...]
It would be nice if we could change the flags to either

 a) avoid cutting off
 b) indicate something has been cut off (<- I prefer this)
That sounds like a nice feature request for 'less': a marker on the
right margin when --chop-long-lines is in use and a line has been
chopped.  I don't see it at
http://www.greenwoodsoftware.com/less/bugs.html#enhance so maybe no
one else has thought of it yet.

Mark, what do you think?

Thanks,
Jonathan

Re: Harmful LESS flags

From: Mark Nudelman <hidden>
Date: 2016-06-15 23:00:53

On 4/23/2014 5:11 PM, Jonathan Nieder wrote:
That sounds like a nice feature request for 'less': a marker on the
right margin when --chop-long-lines is in use and a line has been
chopped.  I don't see it at
http://www.greenwoodsoftware.com/less/bugs.html#enhance so maybe no
one else has thought of it yet.

Mark, what do you think?
Hi Jonathan,
This seems reasonable.  I actually thought that something like this was
already implemented, and displayed in the status column when -J is in
effect.  But I must have dreamed that or something.  I'll add this as an
enhancement request.

--Mark
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help