rpms/tcsh/devel tcsh-6.14.00-wide-seeks.patch, NONE, 1.1 tcsh.spec, 1.38, 1.39

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Jul 10 20:52:25 UTC 2006


Author: mitr

Update of /cvs/dist/rpms/tcsh/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv28072

Modified Files:
	tcsh.spec 
Added Files:
	tcsh-6.14.00-wide-seeks.patch 
Log Message:
* Mon Jul 10 2006 Miloslav Trmac <mitr at redhat.com> - 6.14-9
- Fix seeking over multibyte characters (#195972)
- Don't ship obsolete eight-bit.txt


tcsh-6.14.00-wide-seeks.patch:
 sh.h                  |    9 ++++++++-
 tcsh-6.14.00/sh.lex.c |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)

--- NEW FILE tcsh-6.14.00-wide-seeks.patch ---
--- tcsh/sh.h	2005-03-25 19:46:41.000000000 +0100
+++ tcsh-6.14.00/sh.h	2006-07-03 03:45:30.000000000 +0200
@@ -801,6 +801,13 @@
  * exactly one if the input is seekable and tell is available.
  * In other cases, the shell buffers enough blocks to keep all loops
  * in the buffer.
+ *
+ * If (WIDE_STRINGS && cantell), fbobp is always a byte offset, but
+ * (fseekp - fbobp) and (feobp - fbobp) are character offsets (usable for
+ * fbuf indexing).
+ *
+ * If (!cantell), all offsets are character offsets; if (!WIDE_STRINGS), there
+ * is no difference between byte and character offsets.
  */
 EXTERN struct Bin {
     off_t   Bfseekp;		/* Seek pointer, generally != lseek() value */
@@ -824,7 +831,7 @@
 #define TCSH_F_SEEK	 2		/* File seek */
 #define TCSH_E_SEEK	 3		/* Eval seek */
     union {
-	off_t _f_seek;
+	off_t _f_seek;		/* A byte offset if (cantell) */
 	Char* _c_seek;
     } fc;
 #define f_seek fc._f_seek
diff -u tcsh-6.14.00/sh.lex.c tcsh-6.14.00/sh.lex.c
--- tcsh-6.14.00/sh.lex.c	2006-07-03 03:46:11.000000000 +0200
+++ tcsh-6.14.00/sh.lex.c	2006-07-05 16:31:51.000000000 +0200
@@ -1736,7 +1736,9 @@
 	    memmove(cbuf, cbuf + i, partial - i);
 	partial -= i;
     } while (partial != 0 && nchars != 0);
-    /* Throwing away possible partial multibyte characters on error */
+    /* Throwing away possible partial multibyte characters on error if the
+       stream is not seekable */
+    lseek(fildes, -(off_t)partial, L_INCR);
     return res != 0 ? res : r;
 }
 
@@ -1753,7 +1755,13 @@
 	    (void) lseek(SHIN, fseekp, L_SET);
 	}
 	if (fseekp == feobp) {
-	    fbobp = feobp;
+ 	    off_t bytes;
+ 	    size_t i;
+
+ 	    bytes = fbobp;
+ 	    for (i = 0; i < (size_t)(feobp - fbobp); i++)
+ 		bytes += fclens[i];
+ 	    fbobp = fseekp = feobp = bytes;
 	    do
 		c = wide_read(SHIN, fbuf[0], BUFSIZE, 1);
 	    while (c < 0 && errno == EINTR);
@@ -1926,9 +1934,9 @@
 	return;
     case TCSH_F_SEEK:
 #ifdef WIDE_STRINGS
-	if (cantell && fseekp >= fbobp && fseekp < feobp) {
+	if (cantell && fseekp >= fbobp && fseekp <= feobp) {
 	    size_t i;
-	    
+
 	    l->f_seek = fbobp;
 	    for (i = 0; i < fseekp - fbobp; i++)
 		l->f_seek += fclens[i];


Index: tcsh.spec
===================================================================
RCS file: /cvs/dist/rpms/tcsh/devel/tcsh.spec,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- tcsh.spec	23 Mar 2006 02:09:08 -0000	1.38
+++ tcsh.spec	10 Jul 2006 20:52:23 -0000	1.39
@@ -3,7 +3,7 @@
 Summary: An enhanced version of csh, the C shell.
 Name: tcsh
 Version: 6.14
-Release: 8
+Release: 9
 License: distributable
 Group: System Environment/Shells
 Source: ftp://ftp.astron.com/pub/tcsh/tcsh-%{version}.00.tar.gz
@@ -16,6 +16,7 @@
 Patch6: tcsh-6.14.00-sigint.patch
 Patch7: tcsh-6.14.00-wide-crash.patch
 Patch8: tcsh-6.14.00-colors.patch
+Patch9: tcsh-6.14.00-wide-seeks.patch
 Provides: csh = %{version}
 Prereq: fileutils, grep
 URL: http://www.tcsh.org/
@@ -41,8 +42,7 @@
 %patch6 -p1 -b .sigint
 %patch7 -p1 -b .wide-crash
 %patch8 -p1 -b .colors
-
-nroff -me eight-bit.me > eight-bit.txt
+%patch9 -p1 -b .wide-seeks
 
 %build
 %configure --without-hesiod
@@ -102,12 +102,16 @@
 
 %files -f tcsh.lang
 %defattr(-,root,root)
-%doc FAQ Fixes NewThings complete.tcsh eight-bit.txt
+%doc FAQ Fixes NewThings complete.tcsh
 %{_bindir}/tcsh
 %{_bindir}/csh
 %{_mandir}/*/*
 
 %changelog
+* Mon Jul 10 2006 Miloslav Trmac <mitr at redhat.com> - 6.14-9
+- Fix seeking over multibyte characters (#195972)
+- Don't ship obsolete eight-bit.txt
+
 * Thu Mar 23 2006 Miloslav Trmac <mitr at redhat.com> - 6.14-8
 - Backport a patch to ignore LS_COLOR codes introduced in newer coreutils
   (#186037)




More information about the fedora-cvs-commits mailing list