Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#9214 closed defect (fixed)

PATCH: ipkg-utils uses 'du -b' which is unsupported option on darwin

Reported by: Joe Roback <openwrt-devel@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: ipkg, darwin Cc:


The du command on darwin does not support the -b option. Attached is a patch to use ls, works fine, not sure if there is a better way or not.

svn diff tools/ipkg-utils/patches/180-add_installed_size.patch
Index: tools/ipkg-utils/patches/180-add_installed_size.patch
--- tools/ipkg-utils/patches/180-add_installed_size.patch	(revision 26583)
+++ tools/ipkg-utils/patches/180-add_installed_size.patch	(working copy)
@@ -5,7 +5,7 @@
  echo $CONTROL > $tmp_dir/tarX
  ( cd $pkg_dir && $TAR $ogargs -X $tmp_dir/tarX -czf $tmp_dir/data.tar.gz . )
-+installed_size=`du -b $tmp_dir/data.tar.gz | cut -f1`
++installed_size=`ls -l $tmp_dir/data.tar.gz | awk '{print $5}'`
 +sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \
 +	$pkg_dir/$CONTROL/control

Attachments (2)

ipkg-utils_du_darwin_fix.patch (631 bytes) - added by Joe Roback <openwrt-devel@…> 7 years ago.
ipkg-utils_du_darwin_fix.2.patch (1.3 KB) - added by dirtyfreebooter <openwrt-devel@…> 7 years ago.
STAT variable now defined in

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by Joe Roback <openwrt-devel@…>

comment:1 Changed 7 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r26642 and r26643 - thanks for reporting.

comment:2 Changed 7 years ago by dirtyfreebooter <openwrt-devel@…>

If you install GNU stat from coreutils through MacPorts, it gets installed as gstat. So The BSD version of stat can also display bytes by stat -f "%z".

Following the lead of TAR and FIND, attached is a patch that introduces STAT to include/ which will find gstat.

Changed 7 years ago by dirtyfreebooter <openwrt-devel@…>

STAT variable now defined in

comment:3 Changed 7 years ago by jow

This is already handled by OpenWrt as stat is used in various places of the buildroot:

jow-mbpro:trunk jow$ ls -lh staging_dir/host/bin/stat
lrwxr-xr-x  1 jow  staff    20B 13 Apr 15:30 staging_dir/host/bin/stat -> /opt/local/bin/gstat

comment:4 Changed 7 years ago by dirtyfreebooter <openwrt-devel@…>

oh, ok. thanks. I think its time for distclean then, I must have something stale. Thanks!

comment:5 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.