Re: [Xen-devel] [PATCH for-4.11 v4 1/1] Add new add_maintainers.pl script to optimise the workflow when using git format-patch with get_maintainer.pl

2018-05-15 Thread Lars Kurth


On 15/05/2018, 16:35, "Ian Jackson"  wrote:

Lars Kurth writes ("[PATCH for-4.11 v4 1/1] Add new add_maintainers.pl 
script to optimise the workflow when using git format-patch with 
get_maintainer.pl"):
> The tool covers step 2 of the following workflow

Thanks.  Sorry to spot this only now, but

> +sub writefile ($$) {
> +my ($content, $file) = @_;
> +my $fh;
> +open($fh, ">", $file)
> + or die "Could not open file '$file' $!";
> +print $fh $content or die $!;
> +close $fh or die $!;
> +}

this will lose data if your disk is full.

You want:

  sub writefile ($$) {
  my ($content, $file) = @_;
  my $fh;
  open($fh, ">", "$file.tmp")
   or die "Could not open file '$file.tmp' $!";
  print $fh $content or die $!;
  close $fh or die $!;
  ranem "$file.tmp", $file or die "Could not rename '$file' into place 
$!";
  }

(NB: untested.)

Aside from that,

Acked-by: Ian Jackson 

Do you want me to pick up my suggested change and test it ?

If you could do this, yes please
Lars


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH for-4.11 v4 1/1] Add new add_maintainers.pl script to optimise the workflow when using git format-patch with get_maintainer.pl

2018-05-15 Thread Ian Jackson
Lars Kurth writes ("[PATCH for-4.11 v4 1/1] Add new add_maintainers.pl script 
to optimise the workflow when using git format-patch with get_maintainer.pl"):
> The tool covers step 2 of the following workflow

Thanks.  Sorry to spot this only now, but

> +sub writefile ($$) {
> +my ($content, $file) = @_;
> +my $fh;
> +open($fh, ">", $file)
> + or die "Could not open file '$file' $!";
> +print $fh $content or die $!;
> +close $fh or die $!;
> +}

this will lose data if your disk is full.

You want:

  sub writefile ($$) {
  my ($content, $file) = @_;
  my $fh;
  open($fh, ">", "$file.tmp")
   or die "Could not open file '$file.tmp' $!";
  print $fh $content or die $!;
  close $fh or die $!;
  ranem "$file.tmp", $file or die "Could not rename '$file' into place $!";
  }

(NB: untested.)

Aside from that,

Acked-by: Ian Jackson 

Do you want me to pick up my suggested change and test it ?

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel