LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [SCRIPT] Remove "space damage" from patches
@ 2007-01-28 21:37 Richard Knutsson
  2007-01-28 22:52 ` Oleg Verych
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Knutsson @ 2007-01-28 21:37 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Hello Andrew and all

I recently tried "git-apply" on the 2.6.20-rc6-mm1 patch and found it to complain about white-spaces.
So as a mean to (hopefully) cut down on these nasty white-spaces (and sometimes tabs) I wrote this
little script. All it does is checking (lines that are going to be added) for spaces before tabs
and trailing spaces/tabs. I tried it on 2.6.20-rc6-mm1 and it seem to work well

If there is someone interested, _please_ take it. Any suggestion are welcomed :)

Richard Knutsson

--- 

#!/bin/sh

#./<script-name> <patch to check>

msg="Checking..."
echo $msg

while [ "$msg" ]; do \

  msg=""

  if grep -q -E "^\+	* +	" $1; then \
    msg="Found whitespace before tab"
    echo $msg
    sed --in-place -r "s/^\+(	*) {8}( *)	/\+\1	\2	/"	$1
    sed --in-place -r "s/^\+(	*) {1,7}	/\+\1	/"		$1
  fi

  if grep -q -E "^\+.*[	 ]$" $1; then \
    msg="Found trailing whitespace/tab"
    echo $msg
    sed --in-place -r "s/^\+(.*)([^ ])[	 ]+$/\+\1\2/"			$1
    sed --in-place -r "s/^\+[	 ]+$/\+/"				$1
  fi

  if [ "$msg" != "" ]; then \
    echo "Cleaning done, will make another run"
  fi
done



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-28 21:37 [SCRIPT] Remove "space damage" from patches Richard Knutsson
@ 2007-01-28 22:52 ` Oleg Verych
  2007-01-29  0:08   ` Richard Knutsson
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Verych @ 2007-01-28 22:52 UTC (permalink / raw)
  To: linux-kernel

> From: Richard Knutsson
> Newsgroups: gmane.linux.kernel
> Subject: [SCRIPT] Remove "space damage" from patches
> Date: Sun, 28 Jan 2007 22:37:01 +0100

> Hello Andrew and all

Hallo.

> I recently tried "git-apply" on the 2.6.20-rc6-mm1 patch and found it to complain about white-spaces.
> So as a mean to (hopefully) cut down on these nasty white-spaces (and sometimes tabs) I wrote this
> little script. All it does is checking (lines that are going to be added) for spaces before tabs
> and trailing spaces/tabs. I tried it on 2.6.20-rc6-mm1 and it seem to work well
>
> If there is someone interested, _please_ take it. Any suggestion are welcomed :)
>
> Richard Knutsson

Nack, big and fat. It's userspace problem.

If our "developers" can't use or update their every-day-tools, it's a
shame. And this is not trolling: i'm using Jed and GNU Emacs, both are
ok with whitespace "production". 

____


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-28 22:52 ` Oleg Verych
@ 2007-01-29  0:08   ` Richard Knutsson
  2007-01-29  0:31     ` Oleg Verych
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Knutsson @ 2007-01-29  0:08 UTC (permalink / raw)
  To: LKML, Oleg Verych, Andrew Morton

Oleg Verych wrote:
>> From: Richard Knutsson
>> Newsgroups: gmane.linux.kernel
>> Subject: [SCRIPT] Remove "space damage" from patches
>> Date: Sun, 28 Jan 2007 22:37:01 +0100
>>     
>
>   
>> Hello Andrew and all
>>     
>
> Hallo.
>
>   
>> I recently tried "git-apply" on the 2.6.20-rc6-mm1 patch and found it to complain about white-spaces.
>> So as a mean to (hopefully) cut down on these nasty white-spaces (and sometimes tabs) I wrote this
>> little script. All it does is checking (lines that are going to be added) for spaces before tabs
>> and trailing spaces/tabs. I tried it on 2.6.20-rc6-mm1 and it seem to work well
>>
>> If there is someone interested, _please_ take it. Any suggestion are welcomed :)
>>
>> Richard Knutsson
>>     
>
> Nack, big and fat. It's userspace problem.
>
> If our "developers" can't use or update their every-day-tools, it's a
> shame. And this is not trolling: i'm using Jed and GNU Emacs, both are
> ok with whitespace "production".
Oh, I hope I didn't give the impression I wanted it in the kernel (that 
is why i labeled it as SCRIPT and not PATCH), as you said it is a 
userspace problem. I just thought a simple script to remove those 
whitespace could help in an imperfect world. I prefer kate since then 
you can see where the tabs begins (and other features).

Richard Knutsson


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-29  0:08   ` Richard Knutsson
@ 2007-01-29  0:31     ` Oleg Verych
  2007-01-29  1:26       ` Richard Knutsson
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Verych @ 2007-01-29  0:31 UTC (permalink / raw)
  To: linux-kernel

29-01-2007, Richard Knutsson:
> Oleg Verych wrote:
>> Nack, big and fat. It's userspace problem.
>>
>> If our "developers" can't use or update their every-day-tools, it's a
>> shame. And this is not trolling: i'm using Jed and GNU Emacs, both are
>> ok with whitespace "production".
> Oh, I hope I didn't give the impression I wanted it in the kernel (that 
> is why i labeled it as SCRIPT and not PATCH), as you said it is a 
> userspace problem. I just thought a simple script to remove those 
> whitespace could help in an imperfect world. I prefer kate since then 
> you can see where the tabs begins (and other features).

Just to give you idea, how imperfect it is:
<http://marc.theaimsgroup.com/?l=linux-mm-commits&m=116198944205036&w=2>

Anyway, i still think programmers *must* take care of it, if they think
they _are_ Programmers. IMHO LKML already gives obligation to be one.

> Richard Knutsson
>
____


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-29  0:31     ` Oleg Verych
@ 2007-01-29  1:26       ` Richard Knutsson
  2007-01-29  1:43         ` Oleg Verych
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Knutsson @ 2007-01-29  1:26 UTC (permalink / raw)
  To: Oleg Verych, Andrew Morton; +Cc: LKML

Oleg Verych wrote:
> 29-01-2007, Richard Knutsson:
>   
>> Oleg Verych wrote:
>>     
>>> Nack, big and fat. It's userspace problem.
>>>
>>> If our "developers" can't use or update their every-day-tools, it's a
>>> shame. And this is not trolling: i'm using Jed and GNU Emacs, both are
>>> ok with whitespace "production".
>>>       
>> Oh, I hope I didn't give the impression I wanted it in the kernel (that 
>> is why i labeled it as SCRIPT and not PATCH), as you said it is a 
>> userspace problem. I just thought a simple script to remove those 
>> whitespace could help in an imperfect world. I prefer kate since then 
>> you can see where the tabs begins (and other features).
>>     
>
> Just to give you idea, how imperfect it is:
> <http://marc.theaimsgroup.com/?l=linux-mm-commits&m=116198944205036&w=2>
>
> Anyway, i still think programmers *must* take care of it, if they think
> they _are_ Programmers. IMHO LKML already gives obligation to be one
Then I hope you don't mind me asking, why is there (L)indent? Everyone 
can make a mistake and if your editor does not auto-format then there 
may be a whitespace straying.
I also guess you saw that the script is _not_ for cleaning up 
source-files (can be intrusive and is better to be fixed when fixing 
something else), but patches. So if a maintainer does not have anything 
to easily fix those, they might want a simple script to do the work 
(otherwise I believe they just deleted my mail ;) ).

As I said in the posting, it is just if someone is interested in it, 
otherwise you have a Del-button.

Richard Knutsson


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-29  1:26       ` Richard Knutsson
@ 2007-01-29  1:43         ` Oleg Verych
  2007-01-29  2:00           ` Richard Knutsson
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Verych @ 2007-01-29  1:43 UTC (permalink / raw)
  To: Richard Knutsson; +Cc: Andrew Morton, LKML

On Mon, Jan 29, 2007 at 02:26:04AM +0100, Richard Knutsson wrote:
[]
> I also guess you saw that the script is _not_ for cleaning up 
> source-files (can be intrusive and is better to be fixed when fixing 
> something else), but patches.

IMHO it's dealing with consequences, not cause, and it's even worse.

> So if a maintainer does not have anything to easily fix those, they
> might want a simple script to do the work (otherwise I believe they
> just deleted my mail ;) ).

I would like to discuss, would you?

____

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-29  1:43         ` Oleg Verych
@ 2007-01-29  2:00           ` Richard Knutsson
  2007-01-29  2:27             ` Oleg Verych
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Knutsson @ 2007-01-29  2:00 UTC (permalink / raw)
  To: Oleg Verych; +Cc: Andrew Morton, LKML

Oleg Verych wrote:
> On Mon, Jan 29, 2007 at 02:26:04AM +0100, Richard Knutsson wrote:
> []
>   
>> I also guess you saw that the script is _not_ for cleaning up 
>> source-files (can be intrusive and is better to be fixed when fixing 
>> something else), but patches.
>>     
>
> IMHO it's dealing with consequences, not cause, and it's even worse.
>   
How many patches is not to fix bugs, it is worse then some strayed 
whitespace but it is due to reality.
The best is, of course, if neither happened but the next best thing is 
to fix it. And if it can be automated, even better (imho).
>> So if a maintainer does not have anything to easily fix those, they
>> might want a simple script to do the work (otherwise I believe they
>> just deleted my mail ;) ).
>>     
>
> I would like to discuss, would you?
>   
I like to discuss but I am not sure what the result would be. Force 
people to use the editors of our choice?
As long people uses valid e-mail-clients when sending patches (or they 
use the script "sendpatchset"), I'm think we have to be satisfied.
But if you have any ideas, I'm listening.

Richard Knutsson


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [SCRIPT] Remove "space damage" from patches
  2007-01-29  2:00           ` Richard Knutsson
@ 2007-01-29  2:27             ` Oleg Verych
  0 siblings, 0 replies; 8+ messages in thread
From: Oleg Verych @ 2007-01-29  2:27 UTC (permalink / raw)
  To: Richard Knutsson; +Cc: Andrew Morton, LKML

On Mon, Jan 29, 2007 at 03:00:35AM +0100, Richard Knutsson wrote:
> Oleg Verych wrote:
> >On Mon, Jan 29, 2007 at 02:26:04AM +0100, Richard Knutsson wrote:
> >[]
> >  
> >>I also guess you saw that the script is _not_ for cleaning up 
> >>source-files (can be intrusive and is better to be fixed when fixing 
> >>something else), but patches.
> >>    
> >
> >IMHO it's dealing with consequences, not cause, and it's even worse.
> >  
> How many patches is not to fix bugs, it is worse then some strayed 
> whitespace but it is due to reality.
> The best is, of course, if neither happened but the next best thing is 

1. Patches are signed-off (not by you).
2. Maybe Andrew Morton under his sign-off add such feature.

> >> (otherwise I believe they just deleted my mail ;) ).
> >>    
> >
> >I would like to discuss, would you?
> >  
> I like to discuss but I am not sure what the result would be. Force 
> people to use the editors of our choice?
> As long people uses valid e-mail-clients when sending patches (or they 
> use the script "sendpatchset"), I'm think we have to be satisfied.
> But if you have any ideas, I'm listening.

Open-source worker, hammering his fingers? Please, let me out it ;D

> Richard Knutsson
> 

_____

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-01-29  2:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-28 21:37 [SCRIPT] Remove "space damage" from patches Richard Knutsson
2007-01-28 22:52 ` Oleg Verych
2007-01-29  0:08   ` Richard Knutsson
2007-01-29  0:31     ` Oleg Verych
2007-01-29  1:26       ` Richard Knutsson
2007-01-29  1:43         ` Oleg Verych
2007-01-29  2:00           ` Richard Knutsson
2007-01-29  2:27             ` Oleg Verych

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).