all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* SCCS version control cannot cope when latest delta is of type 'removed'
@ 2006-10-27  0:32 Chet Wood
  2006-10-27 22:02 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Chet Wood @ 2006-10-27  0:32 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.4.1 (sparc-sun-solaris2.8, X toolkit)
 of 2005-12-14 on pkg-build
configured using `configure  --prefix=/pkg/gnu --x-includes=/usr/openwin/include:/usr/dt/include --x-libraries=/usr/openwin/lib:/usr/dt/lib --with-x --with-x-toolkit=athena --without-toolkit-scroll-bars --with-xpm --with-tiff --with-jpeg --with-gif --with-png'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

In the shell using regular sccs commands, or in emacs using C-x C-q,
check out an sccs-versioned file that has had its latest delta
removed. Then, in another emacs session, VC commands, such as
vc-directory or vc-next-action, fail.

When vc-sccs-workfile-version(file) searches for the latest version
number in the sccs file, it searches for "^Ad D". However, there can
be another type of delta, namely "^Ad R". In this case, the delta does
not really exist-- it was removed, leaving this delta entry as a
"bread crumb" in the sccs file. The search is limited to the first
delta entry, so it fails and the function returns nil, and as a
result, a blank version number is passed to vcdiff and it fails.

I tried changing the search to accept [D|R] but it then returns the
removed delta number, which does not really exist, and other errors
ensue. 

(This scenario happens sometimes when the Sun CodeManager configuration
management tool is used. It apparently inserts its own bookkeeping
comments by adding and removing a delta. It seems to happen when a new
file is added to the workspace, then the workspace is putback to
another workspace.)

Suggested Fix:
The search should skip the top delta in the sccs file if it is of type
"removed", and return the version number of the next delta.
But IMHO it would be more robust to run the command "sccs
prt filename" to obtain the version, rather than relying on the
internal file format, assuming this works on all platforms.

A workaround is to make a change to the checked-out file (like adding
a blank line to the end or any other change) and check it back
in outside of emacs, creating a real latest delta. Then it can be
checked out again, and should work fine.

Thanks.

Chet Wood
Sun Microsystems


Recent input:
C-x C-b C-x o C-n C-n o C-p C-p C-p C-p C-p C-SPC C-n 
C-n C-n C-n C-n <escape> w C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n C-SPC C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-x C-x C-x C-x C-x C-x C-x C-x <escape> w M-x 
e m a c s - r e p SPC <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> r e p o r SPC b SPC u SPC <backspace> <backspace> 
<backspace> SPC SPC SPC <return>

Recent messages:
vc-sccs-workfile-version
Reading directory /home/cwood/tmp/p/...done
Buffer includes 3 directories
Getting version information... 
Running vcdiff on /home/cwood/tmp/p/SCCS/s.x_10.h...
vc-do-command: Running vcdiff...FAILED (status 2)
Reading directory /home/cwood/tmp/p/...done
Mark set [2 times]
Saved text from ";; Codemgr inserts and deletes a delta i"
Loading emacsbug...done

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

* Re: SCCS version control cannot cope when latest delta is of type 'removed'
  2006-10-27  0:32 SCCS version control cannot cope when latest delta is of type 'removed' Chet Wood
@ 2006-10-27 22:02 ` Kevin Rodgers
  2006-10-31 19:36   ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2006-10-27 22:02 UTC (permalink / raw)


Chet Wood wrote:
 > In the shell using regular sccs commands, or in emacs using C-x C-q,
 > check out an sccs-versioned file that has had its latest delta
 > removed. Then, in another emacs session, VC commands, such as
 > vc-directory or vc-next-action, fail.
 >
 > When vc-sccs-workfile-version(file) searches for the latest version
 > number in the sccs file, it searches for "^Ad D". However, there can
 > be another type of delta, namely "^Ad R". In this case, the delta does
 > not really exist-- it was removed, leaving this delta entry as a
 > "bread crumb" in the sccs file. The search is limited to the first
 > delta entry, so it fails and the function returns nil, and as a
 > result, a blank version number is passed to vcdiff and it fails.
 >
 > I tried changing the search to accept [D|R] but it then returns the
 > removed delta number, which does not really exist, and other errors
 > ensue.
 >
 > (This scenario happens sometimes when the Sun CodeManager configuration
 > management tool is used. It apparently inserts its own bookkeeping
 > comments by adding and removing a delta. It seems to happen when a new
 > file is added to the workspace, then the workspace is putback to
 > another workspace.)
 >
 > Suggested Fix:
 > The search should skip the top delta in the sccs file if it is of type
 > "removed", and return the version number of the next delta.
 > But IMHO it would be more robust to run the command "sccs
 > prt filename" to obtain the version, rather than relying on the
 > internal file format, assuming this works on all platforms.

Your second suggestion may be more robust, but since vc-parse-buffer
returns a useful value to vc-sccs-workfile-version, I think we can take
advantage of that to implement a simple fix:

2006-10-27  Kevin Rodgers  <ihs_4664@yahoo.com>

	* vc-sccs.el (vc-sccs-workfile-version): If the top delta entry
           was removed, return the next entry.


*** vc-sccs.el~	2006-04-22 06:42:26.750000000 -0600
--- vc-sccs.el	2006-10-27 15:53:08.760978700 -0600
***************
*** 144,150 ****
       ;; rather than just the first entry, because the
       ;; first entry might be a deleted ("R") version.
       (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
!     (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)))

   (defun vc-sccs-checkout-model (file)
     "SCCS-specific version of `vc-checkout-model'."
--- 144,155 ----
       ;; rather than just the first entry, because the
       ;; first entry might be a deleted ("R") version.
       (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
!     (let ((top-delta (save-excursion	; vc-parse-buffer changes point
! 		       (vc-parse-buffer "^\001d \\([DR]\\) \\([^ ]+\\)" 2))))
!       (if (and top-delta
! 	       (equal (match-string 1) "R")) ; the delta entry was Removed
! 	  (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)
! 	top-delta))))

   (defun vc-sccs-checkout-model (file)
     "SCCS-specific version of `vc-checkout-model'."

 > A workaround is to make a change to the checked-out file (like adding
 > a blank line to the end or any other change) and check it back
 > in outside of emacs, creating a real latest delta. Then it can be
 > checked out again, and should work fine.

-- 
Kevin

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

* Re: SCCS version control cannot cope when latest delta is of type 'removed'
  2006-10-27 22:02 ` Kevin Rodgers
@ 2006-10-31 19:36   ` Kevin Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2006-10-31 19:36 UTC (permalink / raw)


Kevin Rodgers wrote:
> Chet Wood wrote:
>  > Suggested Fix:
>  > The search should skip the top delta in the sccs file if it is of type
>  > "removed", and return the version number of the next delta.
>  > But IMHO it would be more robust to run the command "sccs
>  > prt filename" to obtain the version, rather than relying on the
>  > internal file format, assuming this works on all platforms.
> 
> Your second suggestion may be more robust, but since vc-parse-buffer
> returns a useful value to vc-sccs-workfile-version, I think we can take
> advantage of that to implement a simple fix:

Sorry for that hastily-posted cruft.  This problem is already fixed
in the development version; you should be able to use the same fix in
Emacs 21:

(defun vc-sccs-workfile-version (file)
   "SCCS-specific version of `vc-workfile-version'."
   (with-temp-buffer
     ;; The workfile version is always the latest version number.
     ;; To find this number, search the entire delta table,
     ;; rather than just the first entry, because the
     ;; first entry might be a deleted ("R") version.
     (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
     (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)))

-- 
Kevin

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

end of thread, other threads:[~2006-10-31 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-27  0:32 SCCS version control cannot cope when latest delta is of type 'removed' Chet Wood
2006-10-27 22:02 ` Kevin Rodgers
2006-10-31 19:36   ` Kevin Rodgers

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.