Bug#568834: Bug#882872: First stab at functionality for copying files

2023-07-03 Thread Nicolas Schier


On Wed 14 Jun 2023 at 09:30:12PM +0200 Nicolas Schier wrote:
> Hi Mako,
> 
> On Fri 09 Jun 2023 12:01:52 GMT, Benj. Mako Hill wrote:
> > Greetings!
> > 
> > This is just a followup to say that I've been using the patch for
> > about two years now and have not noticed any trouble. I use the
> > copying files functionality in vidir nearly every day!
> 
> thanks for your patch and bringing the missing feature back to my mind.  
> I _will_ give you feedback on it within the next two weeks.

Your patch looks good to me and works as promised, thanks!  Before forwarding
it to upstream, we need an appropriate update of vidir documentation.  Are you
interested in preparing that?  (If not, I can do it.)

Kind regards,
Nicolas


-- 
epost|xmpp: nico...@fjasle.eu  irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
 -- frykten for herren er opphav til kunnskap --



Bug#882872: First stab at functionality for copying files

2023-06-14 Thread Nicolas Schier
Hi Mako,

On Fri 09 Jun 2023 12:01:52 GMT, Benj. Mako Hill wrote:
> Greetings!
> 
> This is just a followup to say that I've been using the patch for
> about two years now and have not noticed any trouble. I use the
> copying files functionality in vidir nearly every day!

thanks for your patch and bringing the missing feature back to my mind.  
I _will_ give you feedback on it within the next two weeks.

> If someone wants to take a more active role in maintaince and needs a
> hand, let me know.

I am quite irresolutely how to go on with moreutils in Debian:  
upstream is responsive but it usually takes months until Joey finds 
time to handle moreutils patches (and that reduces the fun to try 
uptreaming patches on my side), and Joey is waiting for someone to 
adopt the upstream maintainence.

In general, I'd like to have Debian's moreutils package strongly 
aligned to the upstream version, but my doubts raise whether this is 
really a sensible policy.  Do you have some thoughts about that?

Kind regards,
Nicolas


signature.asc
Description: PGP signature


Bug#882872: First stab at functionality for copying files

2021-04-02 Thread Benj. Mako Hill
tags 882872 patch
thanks

Greetings!

Thanks for maintaining moreutils! It's one of the packages I love most
in Debian!

I'm attaching a first stab a patch to add copying file support to
vidir (i.e., #882872) which is something I've wanted for a very long
time and just broke down and did today.

It's been quite a while since I've written Perl and I'm not 100% sure
that I've thought the logic through completely so as to avoid all
possible corner cases (e.g., related to every way one would swap
filenames and/or copy things repeatedly).

The way it works is much simpler than the model suggested in #568834,
(which, BTW, sounds very nice): If a line number shows up twice in the
vidir output—and if the two filenames associated with the lines
numbers—are different, the file gets copied. That's it. :)

Regards,
Mako


-- 
Benjamin Mako Hill
https://mako.cc/
--- /home/mako/bin/vidir	2021-04-02 16:48:20.646390946 -0700
+++ /usr/bin/vidir	2019-08-18 06:27:38.0 -0700
@@ -81,7 +81,6 @@
 use File::Path qw(make_path);
 use File::Spec;
 use File::Temp;
-use File::Copy;
 use Getopt::Long;
 
 my $error=0;
@@ -144,7 +143,6 @@
 	die "@editor exited nonzero, aborting\n";
 }
 
-my %finished_item;
 open (IN, $tmp->filename) || die "$0: cannot read ".$tmp->filename.": $!\n";
 while () {
 	chomp;
@@ -152,24 +150,7 @@
 		my $num=int($1);
 		my $name=$2;
 		if (! exists $item{$num}) {
-			# copy files if a dupliate of a number we've already seen before
-			if (exists $finished_item{$num}) {
-if ($name eq $finished_item{$num}) {
-	print STDERR "$0: cannot copy because source ($finished_item{$num}) and destination ($name) are the same\n";
-	delete $item{$num};
-} elsif (-e $name || -l $name) {
-	print STDERR "$0: cannot copy because destination ($name) already exists\n";
-	delete $item{$num};
-} elsif (! (-e $finished_item{$num} || -l $finished_item{$num})) {
-	print STDERR "$0: cannot copy because $finished_item{$num} does not exist\n";
-	delete $item{$num};
-} elsif (! copy($finished_item{$num}, $name)) {
-	print STDERR "$0: failed to copy $finished_item{$num} to $name: $!\n";
-	$error=1;
-}
-			} else {
-die "$0: unknown item number $num\n";
-			}
+			die "$0: unknown item number $num\n";
 		}
 		elsif ($name ne $item{$num}) {
 			next unless length $name;
@@ -225,7 +206,6 @@
 }
 			}
 		}
-		$finished_item{$num} = $name;
 		delete $item{$num};
 	}
 	elsif (/^\s*$/) {


signature.asc
Description: PGP signature