Re: [PATCH] Change in increment_mtime for BSD compatibility of test suite

Subject: Re: [PATCH] Change in increment_mtime for BSD compatibility of test suite

Date: Thu, 26 May 2011 15:12:19 -0700

To: Felix Geller, notmuch@notmuchmail.org

Cc:

From: Carl Worth


On Wed, 25 May 2011 15:07:52 +0200, Felix Geller <fgeller@gmail.com> wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
> Use `-t' option rather than `-d' which is not supported by BSD's
> touch. I'm not sure whether this is the cleanest way to do this, please
> let me know if there is a better way.

I don't know of a better way, but...

> +    last_mod_date=`date -j -f %Y%m%d%H%M%S \`stat -f %Sm -t %Y%m%d%H%M%S ${dir}\` +%s`
>      increment_mtime_amount=$((increment_mtime_amount + 1))
> -    touch -d "+${increment_mtime_amount} seconds" "$dir"
> +    new_date=`date -j -r ${last_mod_date} -v+${increment_mtime_amount}S +%Y%m%d%H%M.%S`
> +    touch -t ${new_date} ${dir}

$ date -j
date: invalid option -- 'j'
Try `date --help' for more information.

:-P

> There are additional changes
> (e.g., sed does not support `-r' but instead `-E') but they seem to be
> incompatible between GNU and BSD. What's the recommended way to handle
> this?

That sounds like something we could test inside our configure
script. In addition to the current Makefile.config file it's creating,
it could also create a little test-config.sh file for things like this.

What do you think?

-Carl

-- 
carl.d.worth@intel.com
part-000.sig (application/pgp-signature)

Thread: