Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2008 15:57:40 +0200 (CEST)
From:      Ulrich Spörlein <uspoerlein@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        stas@FreeBSD.org, pjd@FreeBSD.org, jw@innerewut.de
Subject:   ports/123112: [PATCH] rdoc node numbering non-deterministic on ZFS volumes
Message-ID:  <200804261357.m3QDveiI030040@roadrunner.spoerlein.net>
Resent-Message-ID: <200804261430.m3QEU2Ah077332@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         123112
>Category:       ports
>Synopsis:       [PATCH] rdoc node numbering non-deterministic on ZFS volumes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 26 14:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Spörlein
>Release:        FreeBSD 7.0-STABLE i386
>Organization:
>Environment:
>Description:
I'm running /usr on ZFS and noticed that all pkg-plists from rdoc-using ports
are broken. rdoc is used to convert ruby's inline markup to external HTML files.
It runs recursively, but doesn't sort the output of readdir() *and* uses unique
numbers for every file.

This in effect will lead to "random" page numbering, depending on the output of
readdir()
>How-To-Repeat:
Simple test to demonstrate the ZFS readdir() sorting "problem"

UFS:
% while :; do rm -rf foo; mkdir -p foo/{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z} && (ls -1f foo | md5); done | uniq
b7fdd99fac291c4bbf958d9aee731951
^C

ZFS:
% while :; do rm -rf foo; mkdir -p foo/{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z} && (ls -1f foo | md5); done | uniq
fe4647c6a1bc36cd85ec44ab938e8489
83584ba58ea8abb2a174147b3e16efbb
517eff118b8009964cb4fb83087ed135
aefa552bbe162e3ff881c0fbf27bc350
359620a9f16172ce7e1cd9ad9d79ea2b
517eff118b8009964cb4fb83087ed135
a1f1827e51a455d7cbf83e7f1c2ed8d2
e2c202117483de9b7c8a6e3992e26470
^C

As you can see, directories are not necessarily returned in the order they have
been created, which can be true for UFS, too, but not when appending new
entries to an existing directory, AFAICS.

To see the specific problem with rdoc, install devel/ruby-gems with "make
install package" on a ZFS volume, the pkg_create will fail since the installed
rdoc node files don't match what's listed in pkg-plist.

>Fix:
This patch to ruby's rdoc seems to stabilize the rdoc numbering in my testing.

BE WARNED THOUGH: This will break lots of plists, as they are currently generated
unsorted but deterministically (for UFS; non-deterministically for ZFS!). After
the patch they will be generated sorted all the time.

The patch should be submitted upstream, I'm not sure about the style and conventions
in the ruby world, though.


Side note: There also seems to be an rdoc switch --one-file which will probably
generate only a single page. If we could implement this for all rubygems and
other rdoc using ports (by making it the default on FreeBSD?), this could solve
the problem, too (and cut down the pkg-plist size for a lot of ports).

--- rdoc.patch begins here ---
--- rdoc.rb.orig	2007-02-13 00:01:19.000000000 +0100
+++ rdoc.rb	2008-04-26 15:38:21.830669906 +0200
@@ -200,7 +200,7 @@
     # we may well contain subdirectories which must
     # be tested for .document files
     def list_files_in_directory(dir, options)
-      normalized_file_list(options, Dir.glob(File.join(dir, "*")), false, options.exclude)
+      normalized_file_list(options, Dir.glob(File.join(dir, "*")).sort, false, options.exclude)
     end
 
 
--- rdoc.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804261357.m3QDveiI030040>