sh pain (cl vs execve)

Richard Williamson richard.williamson at u4eatech.com
Thu Nov 11 00:56:09 PST 2004


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




More information about the freebsd-questions mailing list