unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Bug in copy-file
@ 2003-01-30 16:30 Lars Hansen
  2003-01-30 17:28 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Hansen @ 2003-01-30 16:30 UTC (permalink / raw)


A bug has been introduced since Emacs 21.2.
A "!" has been added where it should not be.
As a consequence the keep-time parameter functions
opposite of what is intended. The patch below
should fix the problem.

Lars Hansen

*** 2405,2411 ****
   		 SDATA (encoded_newname),
   		 FALSE))
       report_file_error ("Copying file", Fcons (file, Fcons (newname, 
Qnil)));
!   else if (!NILP (keep_time))
       {
         EMACS_TIME now;
         DWORD attributes;
--- 2405,2411 ----
   		 SDATA (encoded_newname),
   		 FALSE))
       report_file_error ("Copying file", Fcons (file, Fcons (newname, 
Qnil)));
!   else if (NILP (keep_time))
       {
         EMACS_TIME now;
         DWORD attributes;

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

* Re: Bug in copy-file
  2003-01-30 16:30 Bug in copy-file Lars Hansen
@ 2003-01-30 17:28 ` Andreas Schwab
  2003-01-31  7:36   ` Lars Hansen
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2003-01-30 17:28 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Lars Hansen <larsh@math.ku.dk> writes:

|> A bug has been introduced since Emacs 21.2.
|> A "!" has been added where it should not be.
|> As a consequence the keep-time parameter functions
|> opposite of what is intended. The patch below
|> should fix the problem.

Why do you think so?  The use of keep-time is correct according to the
doc string.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Bug in copy-file
  2003-01-30 17:28 ` Andreas Schwab
@ 2003-01-31  7:36   ` Lars Hansen
  2003-01-31 11:18     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Hansen @ 2003-01-31  7:36 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Andreas Schwab wrote:

>Lars Hansen <larsh@math.ku.dk> writes:
>
>|> A bug has been introduced since Emacs 21.2.
>|> A "!" has been added where it should not be.
>|> As a consequence the keep-time parameter functions
>|> opposite of what is intended. The patch below
>|> should fix the problem.
>
>Why do you think so?  The use of keep-time is correct according to the
>doc string.
>
>Andreas.
>
Maybe I am misreading the code or the doc string. I read them like this:
Doc string says:

    Fourth arg KEEP-TIME non-nil means give the new file the same
    last-modified time as the old one.

But when keep_time is non-nil, NILP (keep_time) is false, so !NILP
(keep_time)
is true. Thus the code following if (NILP (keep_time)) is entered. In
this code it
reads

       EMACS_GET_TIME (now);

and

       if (set_file_times (filename, now, now))

so the time is set to now, not kept.

Am I wrong?
By the way, it is easy to test: Just do eg:

    (copy-file "junk" "keep" t t)
    (copy-file "junk" "new" t nil)

Lars

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

* Re: Bug in copy-file
  2003-01-31  7:36   ` Lars Hansen
@ 2003-01-31 11:18     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2003-01-31 11:18 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Lars Hansen <larsh@math.ku.dk> writes:

|> Andreas Schwab wrote:
|> 
|> >Lars Hansen <larsh@math.ku.dk> writes:
|> >
|> >|> A bug has been introduced since Emacs 21.2.
|> >|> A "!" has been added where it should not be.
|> >|> As a consequence the keep-time parameter functions
|> >|> opposite of what is intended. The patch below
|> >|> should fix the problem.
|> >
|> >Why do you think so?  The use of keep-time is correct according to the
|> >doc string.
|> >
|> >Andreas.
|> >
|> Maybe I am misreading the code or the doc string. I read them like this:
|> Doc string says:
|> 
|>     Fourth arg KEEP-TIME non-nil means give the new file the same
|>     last-modified time as the old one.
|> 
|> But when keep_time is non-nil, NILP (keep_time) is false, so !NILP
|> (keep_time)
|> is true. Thus the code following if (NILP (keep_time)) is entered. In
|> this code it
|> reads
|> 
|>        EMACS_GET_TIME (now);
|> 
|> and
|> 
|>        if (set_file_times (filename, now, now))
|> 
|> so the time is set to now, not kept.
|> 
|> Am I wrong?

No, you are right.  I didn't know that windows is backwards.

|> By the way, it is easy to test: Just do eg:

You first need to install a proprietary operating system, which is a very
difficult and expensive part.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2003-01-31 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-30 16:30 Bug in copy-file Lars Hansen
2003-01-30 17:28 ` Andreas Schwab
2003-01-31  7:36   ` Lars Hansen
2003-01-31 11:18     ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).