Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2004 08:56:04 +0000
From:      Richard Williamson <richard.williamson@u4eatech.com>
To:        freebsd-questions@freebsd.org
Subject:   sh pain (cl vs execve)
Message-ID:  <6.1.2.0.2.20041111084142.0266f138@cygnus>

next in thread | raw e-mail | index | archive | help
Hello the list,

I've got a sh script that updates a group of files in non-volatile
storage from versions in the root filesystem (at /dev/md0 if that
is important), if the files in ram are more up-to-date.  Easy enough
in theory.

If I call the sh script from the command line it works as expected.
If the script is called using execve from inside some code, the
script completes, however the data is not updated in flash.

Output from syslog:
1 Feb 14 01:37:58 RDP checkSettings: start
2 Feb 14 01:37:58 RDP checkSettings: diffs in currentconfig
3 Feb 14 01:37:58 RDP : CheckAndAutosave status: 1
4 Feb 14 01:37:58 RDP saveSettings: done

lines 1 and 2 are the result of a call to /scripts/checkSettings.
This returns 1 if any file in a discrete list is found to differ
between that which is in memory and that which is in the flash.

line 3 is the code reporting that checkSettings returned 1 when
called via execve().

line 4 is the result of a call to /scripts/saveSettings, saying
that it had done its job and that all files in flash were now
up to date.

Sadly:

RDP 18:03 [~] rip>diff /settings/currentconfig /init/settings/currentconfig
1c1
< 2
---
> 1
RDP 18:03 [~] rip>

This is clearly not the case.  

RDP 18:03 [~] rip>/scripts/saveSettings
RDP 18:04 [~] rip>!diff
diff /settings/currentconfig /init/settings/currentconfig
RDP 18:04 [~] rip>

What am I missing?  I've checked things like permissions (the code
is being run by user root, the files and directories on /init are
all owned by root).  What else?

tia,
rip




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