Re: ksh: extra rewind call

2017-10-19 Thread Jeremie Courreges-Anglas
On Thu, Oct 19 2017, Sebastian Benoit  wrote:
> Jeremie Courreges-Anglas(j...@wxcvbn.org) on 2017.10.19 00:36:00 +0200:
>> 
>> This call was added along with the magic check, but it not actually
>> needed: history_load already calls rewind(3).  I feel like the magic
>> check should also be in history_load(), so that a ksh process can
>> recover at runtime from a binary->plaintext history file migration.
>> Worth the trouble?
>
> unsure, without extra work (backport) only people who upgrade from 6.1 (and
> earlier) to 6.3 or snap from sometime in summer to now would benefit, right?

I took a look and it seems a bit more involved than I initially thought,
so I just abandoned the idea.

>> ok for the diff below?
>
> yes ok benno

Thanks,

>
>> Index: history.c
>> ===
>> RCS file: /d/cvs/src/bin/ksh/history.c,v
>> retrieving revision 1.72
>> diff -u -p -p -u -r1.72 history.c
>> --- history.c18 Oct 2017 15:41:25 -  1.72
>> +++ history.c18 Oct 2017 22:25:23 -
>> @@ -799,8 +799,6 @@ hist_init(Source *s)
>>  return;
>>  }
>>  
>> -rewind(histfh);
>> -
>>  history_load(s);
>>  
>>  history_lock(LOCK_UN);
>> 
>> 
>> -- 
>> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
>> 
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: ksh: extra rewind call

2017-10-19 Thread Sebastian Benoit
Jeremie Courreges-Anglas(j...@wxcvbn.org) on 2017.10.19 00:36:00 +0200:
> 
> This call was added along with the magic check, but it not actually
> needed: history_load already calls rewind(3).  I feel like the magic
> check should also be in history_load(), so that a ksh process can
> recover at runtime from a binary->plaintext history file migration.
> Worth the trouble?

unsure, without extra work (backport) only people who upgrade from 6.1 (and
earlier) to 6.3 or snap from sometime in summer to now would benefit, right?

> ok for the diff below?

yes ok benno


> Index: history.c
> ===
> RCS file: /d/cvs/src/bin/ksh/history.c,v
> retrieving revision 1.72
> diff -u -p -p -u -r1.72 history.c
> --- history.c 18 Oct 2017 15:41:25 -  1.72
> +++ history.c 18 Oct 2017 22:25:23 -
> @@ -799,8 +799,6 @@ hist_init(Source *s)
>   return;
>   }
>  
> - rewind(histfh);
> -
>   history_load(s);
>  
>   history_lock(LOCK_UN);
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 



ksh: extra rewind call

2017-10-18 Thread Jeremie Courreges-Anglas

This call was added along with the magic check, but it not actually
needed: history_load already calls rewind(3).  I feel like the magic
check should also be in history_load(), so that a ksh process can
recover at runtime from a binary->plaintext history file migration.
Worth the trouble?

ok for the diff below?


Index: history.c
===
RCS file: /d/cvs/src/bin/ksh/history.c,v
retrieving revision 1.72
diff -u -p -p -u -r1.72 history.c
--- history.c   18 Oct 2017 15:41:25 -  1.72
+++ history.c   18 Oct 2017 22:25:23 -
@@ -799,8 +799,6 @@ hist_init(Source *s)
return;
}
 
-   rewind(histfh);
-
history_load(s);
 
history_lock(LOCK_UN);


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE