Well that suggested patch had about the same effect, but was close enough
to suggest out a possible solution.

First, I should point out that while the file was deleted, the buffer did
remain intact (relief).  My mistake before -- too many buffers.

Here's the result of the patch (1st cut):

$ admin -r1.1 -fb -iindex.html -y 
/r\@scpx\:weblog1\:/www/webhosting.pncbank.com/docs/SCCS/s.index.html; 
tramp_old_status=$?
ERROR [/r@scpx:weblog1:/www/webhosting.pncbank.com/docs/SCCS/s.index.html]: cannot 
create lock file (cm4)
$ tramp_set_exit_status $tramp_old_status; echo tramp_exit_status $?
tramp_exit_status 1
$ echo $?
0
$ rm -f /www/webhosting.pncbank.com/docs/index.html ; echo ok
ok

The -iFILE is correct but the last arg remained wrong.

I made a further modification and got the desired result (!)

In addition to the -iFILE arg, what I took to be a comment (-y
/r@METHOD:HOST:/PATH/TO/FILE) was actually no comment at all (-yCOMMENT --
no space -- being the needed syntax and there's no COMMENT involved here at
all so the -y is gratuitous?).

Instead that last arg is the new SCCS name (the s.FILE).  So this is where
I am:

@@ -177,7 +177,7 @@
     (apply 'vc-do-command nil 0 "admin" nil
            (and rev (concat "-r" rev))
            "-fb"
-           (concat "-i" file)
+           (concat "-i" (file-relative-name file))
            (and comment (concat "-y" comment))
-           vc-name
+            (file-relative-name vc-name)
            switches))

I hacked that 2nd change in there so the patch is probably in an invalid
format but you know what I mean.

I'm not too sure this won't break VC in a non-Tramp invocation or for folk
using a non-default SCCS project dir (i.e not ./SCCS.)

I wonder if the earlier construction of vc-name and/or project-dir is the
"right" place to do this? (All in vc.el we're talking here.)

I still think the bigger concern is the unconditional(?) (delete-file file)
in vc.el which appears to fire regardless of $? or else, as I noted once
before, $? is falsely cleared by echo $tramp_exit_status.

Why not this:

     tramp_set_exit_status() {
+      tramp_exit_status=$1
+      echo tramp_exit_status $tramp_exit_status
+      return $tramp_exit_status
-      return $1
     }

and then replace lines like:

     $ COMMAND; echo tramp_exit_status $?

with:

     $ COMMAND; tramp_set_exit_status $?

Both yield identical STDOUT but the latter preserves $? after the echo.

But then I'm not entirely sure what's intended by:

     $ tramp_set_exit_status $tramp_old_status; echo tramp_exit_status $?

Thanks for the help, getting better all the time.

KET





"Stefan Monnier" <[EMAIL PROTECTED]>
@rum.cs.yale.edu on 03/28/2001 12:04:08 PM

Sent by:  [EMAIL PROTECTED]


To:   [EMAIL PROTECTED]
cc:
Subject:  Re: tramp ($Id: tramp.el,v 2.0.2.2 2001/03/03 00:06:34 grossjoh
      Exp $); Trampled file during sccs create (sic) admin


>>>>> "Daniel" == Daniel Pittman <[EMAIL PROTECTED]> writes:
>> Basically, the admin command was passed
>> -i/r@METHOD:HOST:/PATH/TO/FILE/ where -iFILE would suffice.
>> Compounding the problem, the error wasn't noticed and the file and
>> buffer destroyed.

I only have the development version of VC right now, so the patch below
won't apply properly, but you should be able to adapt it to your vc.el.

It's completely untested, so please tell us if it helps,


        Stefan


@@ -177,7 +177,7 @@
     (apply 'vc-do-command nil 0 "admin" nil
            (and rev (concat "-r" rev))
            "-fb"
-           (concat "-i" file)
+           (concat "-i" (file-relative-name file))
            (and comment (concat "-y" comment))
            vc-name
            switches))




Reply via email to