Control: tags 907429 + patch
Control: tags 907429 + pending

Dear maintainer,

I've prepared an NMU for libphysfs (versioned as 3.0.1-3.1) and
uploaded it to DELAYED/5. Please feel free to tell me if I
should delay it longer.

Regards,

Stephen
diff -Nru libphysfs-3.0.1/debian/changelog libphysfs-3.0.1/debian/changelog
--- libphysfs-3.0.1/debian/changelog	2018-11-29 15:10:13.000000000 +0100
+++ libphysfs-3.0.1/debian/changelog	2018-12-01 15:27:09.000000000 +0100
@@ -1,3 +1,10 @@
+libphysfs (3.0.1-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix the fsync patch. Really closes: #907429.
+
+ -- Stephen Kitt <[email protected]>  Sat, 01 Dec 2018 15:27:09 +0100
+
 libphysfs (3.0.1-3) unstable; urgency=medium
 
   * Bump Standards-Version to 4.2.1.
diff -Nru libphysfs-3.0.1/debian/patches/02-fsync.diff libphysfs-3.0.1/debian/patches/02-fsync.diff
--- libphysfs-3.0.1/debian/patches/02-fsync.diff	2018-11-29 15:10:13.000000000 +0100
+++ libphysfs-3.0.1/debian/patches/02-fsync.diff	2018-11-30 11:24:26.000000000 +0100
@@ -1,52 +1,63 @@
-# Upstream patch to fix a performance problem.
-# Closes: #907429
-# URL: https://hg.icculus.org/icculus/physfs/rev/c17f025e7a92
-
-diff -Naur libphysfs-3.0.1.orig/physfs.c libphysfs-3.0.1/physfs.c
---- libphysfs-3.0.1.orig/physfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ libphysfs-3.0.1/physfs.c	2018-11-29 15:05:50.430790919 +0100
-@@ -0,0 +1,44 @@
-+
-+diff -r ece6769c0676 -r c17f025e7a92 src/physfs.c
-+--- a/src/physfs.c	Wed Oct 03 22:40:57 2018 -0400
-++++ b/src/physfs.c	Tue Nov 27 23:53:33 2018 -0500
-+@@ -2669,7 +2669,6 @@
-+ {
-+     FileHandle *prev = NULL;
-+     FileHandle *i;
-+-    int rc = 1;
-+ 
-+     for (i = *list; i != NULL; i = i->next)
-+     {
-+@@ -2677,9 +2676,16 @@
-+         {
-+             PHYSFS_Io *io = handle->io;
-+             PHYSFS_uint8 *tmp = handle->buffer;
-+-            rc = PHYSFS_flush((PHYSFS_File *) handle);
-+-            if (!rc)
-++
-++            /* send our buffer to io... */
-++            if (!PHYSFS_flush((PHYSFS_File *) handle))
-+                 return -1;
-++
-++            /* ...then have io send it to the disk... */
-++            else if (io->flush && !io->flush(io))
-++                return -1;
-++
-++            /* ...then close the underlying file. */
-+             io->destroy(io);
-+ 
-+             if (tmp != NULL)  /* free any associated buffer. */
-+@@ -2977,7 +2983,7 @@
-+     rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos);
-+     BAIL_IF_ERRPASS(rc <= 0, 0);
-+     fh->bufpos = fh->buffill = 0;
-+-    return io->flush ? io->flush(io) : 1;
-++    return 1;
-+ } /* PHYSFS_flush */
-+ 
-+ 
-+
+
+# HG changeset patch
+# User Ryan C. Gordon <[email protected]>
+# Date 1543380813 18000
+# Node ID c17f025e7a923a487c9fea87bb9c754b147d45de
+# Parent  ece6769c0676c2d4e8a5893a1acebd0f65456817
+PHYSFS_flush() shouldn't call PHYSFS_Io::flush().
+
+The former is meant to send PhysicsFS-buffered data to the PHYSFS_Io's
+implementation, the latter is meant to tell the OS to definitely make sure the
+data is safely written to disk (or at least, that's what it does in practice).
+
+This was making PHYSFS_setBuffer()'d handles _slower_, since they would end
+up blocking whenever the buffer was full until the data made the full trip to
+physical media, instead of just letting the OS do its own buffering.
+
+Now we still PHYSFS_Io::flush() on PHYSFS_close(), like this has always
+worked. That might also be overkill, but that remains a historical artifact
+of trying to keep the underlying file handle usable if pending writes fail
+for possibly-recoverable reasons (which isn't guaranteed if you just close()
+it, at least as far as I remember).
+(transplanted from 8b3cc36531c6ac09dbac98d3774921bdf14b240d)
+
+diff -r ece6769c0676 -r c17f025e7a92 src/physfs.c
+--- a/src/physfs.c	Wed Oct 03 22:40:57 2018 -0400
++++ b/src/physfs.c	Tue Nov 27 23:53:33 2018 -0500
+@@ -2669,7 +2669,6 @@
+ {
+     FileHandle *prev = NULL;
+     FileHandle *i;
+-    int rc = 1;
+ 
+     for (i = *list; i != NULL; i = i->next)
+     {
+@@ -2677,9 +2676,16 @@
+         {
+             PHYSFS_Io *io = handle->io;
+             PHYSFS_uint8 *tmp = handle->buffer;
+-            rc = PHYSFS_flush((PHYSFS_File *) handle);
+-            if (!rc)
 +
++            /* send our buffer to io... */
++            if (!PHYSFS_flush((PHYSFS_File *) handle))
+                 return -1;
 +
++            /* ...then have io send it to the disk... */
++            else if (io->flush && !io->flush(io))
++                return -1;
 +
++            /* ...then close the underlying file. */
+             io->destroy(io);
+ 
+             if (tmp != NULL)  /* free any associated buffer. */
+@@ -2977,7 +2983,7 @@
+     rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos);
+     BAIL_IF_ERRPASS(rc <= 0, 0);
+     fh->bufpos = fh->buffill = 0;
+-    return io->flush ? io->flush(io) : 1;
++    return 1;
+ } /* PHYSFS_flush */
+ 
+ 
+

Attachment: signature.asc
Description: PGP signature

Reply via email to