pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/56645: Patches to fix mtime and atime handling in



>Number:         56645
>Category:       pkg
>Synopsis:       Patches to fix mtime and atime handling in
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 20 07:45:00 +0000 2022
>Originator:     Brian Buhrow
>Release:        NetBSD any version
>Organization:
NFB of California
	
>Environment:
	
	
>Description:
	
These patches fix a very long standing bug where aguments passed to utime(3) by IMAP-UW and the
c-client library were incorrect.  Unfortunately, on 32-bit systems, the the bug went unnoticed
because all the bits lined up correctly.  On 64-bit systems, this happenstance doesn't work,
meaning the mtime and atime time stamps this software modifies are completely wrong, usually
defaulting to the beginning of the epoch, but only because the random memory locations pointed
to by the incorrect pointers are  0.
Fortunately, the software package includes a portable version of the utime library call that
converts the internal usage of this function to one that's compatible with the one resident in
libc on NetBSD, FreeBSD and other BSD systems.  This patch simply enables that portable code
when compiling this package  on BSD systems while using the pkgsrc system.

this bug report is simply to more fully document the changes I'm about to commit to the pkgsrc
tree.  these patches have been compiled and are running in production on a 64-bit NetBSD/amd64
system running NetBSD-9.2.  Unless there is a strong objection, I'll commit this patch in the
next few days.


>How-To-Repeat:
	
Run IMAP-UW on a 64-bit NetBSD system and watch the time stamps  on all the files it touches
become unusable.
>Fix:
	
? patches/patch-bi
? patches/patch-bj
cvs diff: Diffing .
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/mail/imap-uw/distinfo,v
retrieving revision 1.50
diff -u -r1.50 distinfo
--- distinfo	26 Oct 2021 10:54:03 -0000	1.50
+++ distinfo	20 Jan 2022 05:17:05 -0000
@@ -4,7 +4,7 @@
 SHA512 (imap-2007f.tar.Z) = 2c728deaf66d23158c61ae55ff94f05d2a1cf0168002760321ca30c6ee1c58c0a4c7bc14ece0097ea662df6c7c49be3b91c8e5e943724c9e2736800fa9298dae
 Size (imap-2007f.tar.Z) = 2793529 bytes
 SHA1 (patch-aa) = ac880c250dfee3d0d316063ace5b92cd2f190510
-SHA1 (patch-ab) = c7985a2db4d4b5c8d2644492b2e48f8ebe2d64b1
+SHA1 (patch-ab) = d42bb314b2bdf4058d6f44e2740f1876d69aa6cb
 SHA1 (patch-ac) = eab1435fdf7ab59ea8afbde949a92dd756e6aea3
 SHA1 (patch-ad) = d817dca51413bb8d228c2fabadffa3b924dff11d
 SHA1 (patch-ae) = 85e0917ce1934f6789bbce45ad5321e28cf294d9
@@ -16,7 +16,7 @@
 SHA1 (patch-al) = aeb9021e41756db7c67346212dbb441ba7d9885a
 SHA1 (patch-am) = f0c5d250d69976c85537c9b8080365e8c2391c9d
 SHA1 (patch-ao) = b23f356cdeaccd996fd2d11b23da265b6b0df49f
-SHA1 (patch-ap) = 3cd56196e6bc770e4398b97ba5a73f724af2a225
+SHA1 (patch-ap) = c3f7847589a235ad6d9b90cd40d65a76cc52cd2a
 SHA1 (patch-aq) = 33399fb6dd6478d3a89ec1e967b12d93d9a8219b
 SHA1 (patch-ar) = 32f3347697566439b059811be955dc2d3f56cd74
 SHA1 (patch-as) = d07e37e0789251e703805e4d120f6df86d6f5852
@@ -35,6 +35,8 @@
 SHA1 (patch-bf) = 63c582e88bd6286295d5d9639bafec355278d537
 SHA1 (patch-bg) = c95483ed73d7c6015df99967c0509cf0ea67d28f
 SHA1 (patch-bh) = c43dc5df9fb61ea44b5195fc15c697e5f540dfae
+SHA1 (patch-bi) = 19867a536878049b31d677f06124c8ca0efde801
+SHA1 (patch-bj) = 09dfd05373d05a339dbaf725f8607522853aa848
 SHA1 (patch-src_c-client_mail.c) = fca90d3a5a8770b8728bdef6aec2623d16c12b6d
 SHA1 (patch-src_c-client_misc.c) = d22ca95fb333b5234c66440faf5d6e30a148bad1
 SHA1 (patch-src_c-client_misc.h) = 5cf51d186b04ebb45c79b8042bbdcb01716dd2ce
cvs diff: Diffing patches
Index: patches/patch-ab
===================================================================
RCS file: /cvsroot/pkgsrc/mail/imap-uw/patches/patch-ab,v
retrieving revision 1.25
diff -u -r1.25 patch-ab
--- patches/patch-ab	25 Jan 2010 23:04:49 -0000	1.25
+++ patches/patch-ab	20 Jan 2022 05:17:06 -0000
@@ -1,7 +1,7 @@
 $NetBSD: patch-ab,v 1.25 2010/01/25 23:04:49 tron Exp $
 
---- src/osdep/unix/Makefile.orig	2008-06-04 19:18:34.000000000 +0100
-+++ src/osdep/unix/Makefile	2010-01-25 22:56:57.000000000 +0000
+--- src/osdep/unix/Makefile.orig	2011-07-22 17:20:10.000000000 -0700
++++ src/osdep/unix/Makefile	2022-01-15 07:49:18.399845264 -0800
 @@ -48,7 +48,7 @@
  # Try to have some consistency in GCC builds.  We want optimization, but we
  # also want to be able to debug.
@@ -11,7 +11,7 @@
  GCC4CFLAGS= $(GCCCFLAGS) -Wno-pointer-sign
  
  
-@@ -149,7 +149,7 @@
+@@ -149,11 +149,11 @@
  
  # Normally no need to change any of these
  
@@ -20,7 +20,12 @@
  BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \
   dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
   rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
-@@ -529,7 +529,7 @@
+- unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
++ unix.o utime.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
+ CFLAGS=-g
+ 
+ CAT=cat
+@@ -537,7 +537,7 @@
  	$(BUILD) `$(CAT) SPECIALS` OS=bsi \
  	 CRXTYPE=nfs \
  	 SPOOLDIR=/var \
@@ -29,7 +34,7 @@
  	 RSHPATH=/usr/bin/rsh \
  	 BASECFLAGS="$(GCCCFLAGS)" \
  	 BASELDFLAGS="-lcrypt"
-@@ -718,7 +718,7 @@
+@@ -726,7 +726,7 @@
  	 RSHPATH=/usr/bin/rsh \
  	 BASECFLAGS="-g -O -w" \
  	 BASELDFLAGS="-lsocket -lnsl -lgen" \
@@ -38,7 +43,7 @@
  
  
  # Note: It is a long and disgusting story about why cc is set to ucbcc.  You
-@@ -855,7 +855,7 @@
+@@ -863,7 +863,7 @@
  	@$(SH) ARCHIVE
  
  .c.o:
@@ -47,7 +52,7 @@
  
  
  # Cleanup
-@@ -915,7 +915,7 @@
+@@ -923,7 +923,7 @@
  	@echo pem.h, buffer.h, bio.h, and crypto.h, that means that OpenSSL
  	@echo is not installed on your system.  Either install OpenSSL first
  	@echo or build with command: make `$(CAT) OSTYPE` SSLTYPE=none
@@ -56,7 +61,7 @@
  
  osdep.c: osdepbas.c osdepckp.c osdeplog.c osdepssl.c
  	$(CAT) osdepbas.c osdepckp.c osdeplog.c osdepssl.c > osdep.c
-@@ -968,7 +968,7 @@
+@@ -976,7 +976,7 @@
  	 -DLOCKPGM1=\"$(LOCKPGM1)\" -DLOCKPGM2=\"$(LOCKPGM2)\" \
  	 -DLOCKPGM3=\"$(LOCKPGM3)\" > OSCFLAGS
  	echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
Index: patches/patch-ap
===================================================================
RCS file: /cvsroot/pkgsrc/mail/imap-uw/patches/patch-ap,v
retrieving revision 1.4
diff -u -r1.4 patch-ap
--- patches/patch-ap	11 Jun 2009 08:13:05 -0000	1.4
+++ patches/patch-ap	20 Jan 2022 05:17:06 -0000
@@ -1,14 +1,12 @@
 $NetBSD: patch-ap,v 1.4 2009/06/11 08:13:05 wiz Exp $
 
---- src/osdep/unix/unix.c.orig	2008-06-04 13:39:54.000000000 -0500
-+++ src/osdep/unix/unix.c
-@@ -40,8 +40,8 @@
+--- src/osdep/unix/unix.c.orig	2011-07-22 17:20:10.000000000 -0700
++++ src/osdep/unix/unix.c	2022-01-18 22:13:13.433534293 -0800
+@@ -40,7 +40,6 @@
  #include <stdio.h>
  #include <ctype.h>
  #include <errno.h>
 -extern int errno;		/* just in case */
  #include <signal.h>
-+#include <utime.h>	/* need this to get __utime50() prototype on NetBSD */
  #include "mail.h"
  #include "osdep.h"
- #include <time.h>

<patch-bi>
$NetBSD$

--- src/osdep/unix/os_bsi.h.orig	2011-07-22 17:20:11.000000000 -0700
+++ src/osdep/unix/os_bsi.h	2022-01-15 07:49:59.934504576 -0800
@@ -41,3 +41,6 @@
 #include "ftl.h"
 #include "nl.h"
 #include "tcp.h"
+
+#undef utime
+#define utime portable_utime

<patch-bj>
$NetBSD$

--- src/osdep/unix/utime.c.orig	2011-07-22 17:20:10.000000000 -0700
+++ src/osdep/unix/utime.c	2022-01-15 08:29:29.662938659 -0800
@@ -26,6 +26,8 @@
  * Last Edited:	30 August 2006
  */
 
+#include <utime.h>
+#include <string.h>
 #undef utime
 
 /* Portable utime() that takes it args like real Unix systems

>Unformatted:
 IMAP-UW
 	
 	


Home | Main Index | Thread Index | Old Index