Sec, blogmal! - patches

Categories:

Everything

Januar '09

MoDiMiDoFrSaSo
2930311234
567891011
12131415161718
19202122232425
2627282930311

Archive:

Sat, 21 Jan 2006

Large files on NTFS on FreeBSD.

Well, it seems its crappy software week all over again.

While trying to find out how to burn an .iso image on a DVD using only free(as in beer) software, I had interesting experiences with CD Burner XP on Windows, which simply ruined an empty disk in 37 seconds without even trying to write the actual data onto the disk, and some (patched) windows-cdrecord which spewed interesting error messages, and astonished me by interpreting the speed= command line in a creative way (so 1 means 4, 10 means 8 and 16 means 17? interesting ;) - but at least it didn't ruin another blank disk.

Then I tried using FreeBSD. cdrecord from the ports tells me that the Author has completely lost it which means I would have to jump some hoops before I could have the holy grail of DVD support.

Well. Some more digging led me to growisofs from the dvd+rw-tools package which, despite its name, is able to just burn an iso image with the following easy command line

 growisofs -dvd-compat -Z /dev/cd0=image.iso

It does however require device atapicam in your kernel config (see here in the FreeBSD Handbook for details).

This is where we finally touch the subject. Large Files on NTFS. The image was on my NTFS partition. And I was just assuming I could burn it directly. Well, I was wrong and so spent another blank disk on learning that the NTFS driver is not 64 bit clean. You just get the filesize modulo 4G. And yes, the problem is known but they didn't even bother to document it somewhere.

Well, some more searching led me to dimitry who tried to tackle that issue but got no help at all.

I updated the patch he wrote for FreeBSD-6_STABLE (had to fix one simple reject), but be warned, as he notes using mmap on such large files will lead to a panic (I didn't test that ;-). So just to be safe, I copied the file with

  dd if=/dos/.../image.img bs=4M of=/home/sec/image.img

Because dd is guaranteed not to use mmap ;)

If you want/need to use the patch, here is how to you do it:

 cd
fetch http://blogmal.42.org/patches/freebsd-ntfs-largefile/FreeBSD-6-ntfs-largefile.patch
cd /usr/src
parch ~/FreeBSD-6-ntfs-largfile.patch
cd sys/modules/ntfs
make

If you already used ntfs, be sure to unmount all ntfs volumes, and kldunload ntfs.ko before the final step:

 kldload ./ntfs.ko
 mount -t ntfs /dev/ad0s1 /dos

Happy large filing…

– Sec

P.S.: There relevant bug report kern/73514 indicates that a fix for this was committed to FreeBSD-current in November. Yay! I do hope it gets merged to -STABLE soon.


posted at: 05:02 | Category: /patches | permanent link to this entry | 0 comments (trackback)

Sat, 10 Sep 2005

xpdf and copy&paste

Some time ago, a collegue of mine wanted to copy a few sentences from an pdf document he found on the web. Unfortunately the document was protected, so acrobat reader disabled copy&paste.

When he asked for some help, I replied that if he had used some open source viewer like xpdf he wouldn't have had that problem.

Well. As I quickly found out, this was untrue. The author(s) of xpdf had somehow gotten convinced to honor the "protection"-flags of pdf documents.

I spent some time (much more than it would have taken to retype these three sentences) understanding the source, and finally came up with a single-line patch to restore full functionality of xpdf.

Simply apply the following patch and feel unrestricted again.

--- xpdf/XRef.cc.org	Thu Jan 22 02:26:45 2004
+++ xpdf/XRef.cc	Fri Apr 29 12:15:57 2005
@@ -803,6 +803,7 @@
   // this flag has to be set *after* we read the O/U/P strings
   encrypted = encrypted1;
 
+  permFlags = defPermFlags;
   return ret;
 }
 #else

– Sec


posted at: 23:55 | Category: /patches | permanent link to this entry | 0 comments (trackback)

Sat, 03 Sep 2005

Smartmontools - letting sleeping disks sleep

As I wrote in an older entry I do check my disk temperature every minute to create nice Graphs. But this has a bad side-effect. If a disk is spun down (eg. with ataidle) it gets woken up by smartctl.

Some googling revealed, that smartd of the smartmontools has a feature to skip checks when a disk is idle, but smartctl does not. Some patching later, I had added a -n switch, to make smartctl skip reading, if a disk is in SUSPEND mode.

To my dismay, I found that the FreeBSD-specific code did not implement the CHECK_POWER_MODE function (see page 88 of the ATA spec), so I added that one, too.

Of course I have sent the patch with some explanation to the smartmontools developpers, but as usual, they don't even bother to respond to my mail.

So, for anyone who suffers from the same problem, here is the nospinup patch and the Freebsd CHECK_POWER_MODE patch

– Sec


posted at: 16:37 | Category: /patches | permanent link to this entry | 0 comments (trackback)

powered by blosxom
in 0.00 s