Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] portable mechanism to determine noatime

Matthew Martin wrote:
> >> This patch doesn't work on illumos/solaris systems.
> >>
> > Well, it isn't just unique to illumos/solaris.
> > If you build zsh in a directory that is on your root partition (say you don't have a separate /home partition)
> > `df .' returns `/', `grep /' matches every mount point and if any mount point is mounted noatime, the final grep succeeds.
> > But that problem still exist with the use of /etc/mtab.
> What about
> mount | awk '$1 == "'"$(df . | tail -n 1 | cut -d\  -f1)"\" | grep -q noatime

The problems on Solaris are:
  mount is in /sbin which is likely not to be in $path
    - we could use { mount || /sbin/mount } 2>/dev/null
  the default output from df is different.
    - use df -k .
  tail has no -n option, there is /usr/xpg4/bin but
    - use tail -1
  grep has no -q option
    - redirect to /dev/null
  mount output has the filesystem in $1 and device in $3: opposite of Linux/BSD
    - perhaps grep for the filesystem with a trailing space

Something like:
  {mount || /sbin/mount} 2>/dev/null |grep $(df -k .|tail -1 |awk '{print $1}')" .*noatime" >/dev/null

That will still break for strange characters in the mount point.
Whatever we do is probably going to be more fragile than the actual test
case it skips - [[ -N ... ]]. Perhaps we should redo the test case to
only check that -N agrees with a manual comparison after using the zstat


Messages sorted by: Reverse Date, Date, Thread, Author