FPATH taking effect but functions not properly invoked

unix

    Next

  • 1. Bash LINENUM
    Hi, I am trying to trap error with a line number. I have: 1 #!/bin/bash 2 function errTrap() 3 { 4 echo "ERROR: line $1" 5 } 6 trap "errTrap ${LINENUM}" ERR 7 8 t90u3093uq20694u20 Above code will return line 6 (where the trap statement is) not 8. Is there any other way to print out line 8 instead? Thank you, Paul
  • 2. first in last out
    Hi folks, how could I code a bash-script which does a "first in last out" (concerning the lines) on the given filename and writes the resulting lines into the same file? Like a list of --snipp-- V0.0 bla V0.1 blu V0.2 blub --snapp-- converted to --snipp-- V0.2 blub V0.1 blu V0.0 bla --snapp-- Greetings D
  • 3. noob variable assignment question
    I am working on the following script: #!/bin/sh -x src=$1 tgt=$2 max=$3 for P in `$tgt command syntax here | grep $src` do X=`awk '{print $1}'` Y=`awk '{print $2}'` while [ `$src command syntax here | wc -l` -ge $max ] do echo "$max hit. Waiting for 1 minute." sleep 60 done echo "Initializing $X $Y" $tgt command syntax here on $X $Y done However, it gets stuck at the variable assignment of X and Y. Access to shell scripters at my work is slim so I'm hoping for pointers. Thanks. ~F
  • 4. set acpi alarm
    Hello! I want to grant access to the /proc/acpi/alarm file to an ordinary user, on a linux system. Since the file permissions seem to be reset on reboot, I tried to use sudo with the -e option. However sudo -e echo "2006-07-01 22:47:01" > /proc/acpi/alarm obviously doesn't work. How can it be done? Also, I do not know how the entry in the /etc/sudoers file has to look like. Is it the same as for execution of a command? Thank You!
  • 5. find dirs with starts with a number
    Hi Gurus, I am looking for all dirs which starts with a digit [1-9] with find but it doesn't work. What is the correct syntax? Also it should exclude the single dir find /tmp -type d -name '[0-9]*' 200110 -> exclude 200110/01 -> include 200110/02 -> include Best Regards

FPATH taking effect but functions not properly invoked

Postby Kishore » Tue, 13 Jun 2006 23:38:15 GMT

have the following sample shell script called
priv_lib_prod_drone.ksh:
#!/usr/bin/ksh

set -x
if [[ ${LOGNAME} = 'privbtch' ]]
then
export STORE_HOME=/prod/home01/store/privacy
elif [[ ${LOGNAME} = 'u96010' ]]
then
export STORE_HOME=${HOME}
exec 1>>${HOME}/outputlog 2>&1
fi

touch 200604231200 ${STORE_HOME}/data/privacy_drone_0423.dat
touch 200604241200 ${STORE_HOME}/data/privacy_drone_0424.dat

unset FPATH
echo "FPATH variable and PATH are not set up yet: "
echo "${FPATH} is FPATH"
echo "${PATH} is PATH"
echo "Drone files before purge is invoked:........"
ls -l ${STORE_HOME}/data/privacy_drone*

purge ${STORE_HOME}/data/privacy_drone*dat 15
echo "${?} is return code from purge function"
echo "Drone files after purge is invoked:........"
ls -l ${STORE_HOME}/data/privacy_drone*

# set FPATH
export FPATH=/prod/home01/appl/privacy/lib
export PATH=${PATH}:${FPATH}

echo "${FPATH} is FPATH"
echo "${PATH} is PATH"
echo "Drone files before purge is invoked:........"
ls -l ${STORE_HOME}/data/privacy_drone*

purge ${STORE_HOME}/data/'privacy_drone*' 15
echo "${?} is return code from purge function"
echo "Drone files after purge is invoked:........"
ls -l ${STORE_HOME}/data/privacy_drone*

Expalnation of the script:
Lines 16 - 26 Try to invoke the function "purge" without setting FPATH
Lines 28 - 40 Invoke function "purge" after setting FPATH and PATH.

purge is a function to delete all files older than "n" days where n is
the parameter to the function.
u96010@jake:/prod/home01/appl/privacy/lib-> ls -l
total 70
-rw-r-xr-- 1 privprod privbtch 5146 May 4 15:20 cstmarchive
-rw-r-xr-- 1 privprod privbtch 7515 May 4 15:20 fn_check_date
-rw-r-xr-- 1 privprod privbtch 2196 May 4 15:20 ftpctrl
-rw-r-xr-- 1 privprod privbtch 762 May 4 15:20 purge
-rw-r-xr-- 1 privprod privbtch 7562 May 4 15:20 xfrdata
-rw-r-xr-- 1 privprod privbtch 8311 May 4 15:20 xfrsignal

u96010@jake:/prod/home01/appl/privacy/lib-> cat purge
##########################################################################
#
#
# File: purge
#
# Synopsis: purge target_dir purge_days
#
# Description: Purge files in target_dir directory that are older than
#
# specified purge_days.
#
# Return: 0 Successfully purge the files
#
# 1 Failed to purge old files
#
##########################################################################
function purge
{
/usr/bin/find $1 -mtime +$2|/usr/bin/xargs rm -f
if [[ $? -ne 0 ]]
then
return 1
else
return 0
fi
}

When the job priv_lib_prod_drone.ksh is invoked as one user the script
is working as expected.
But if the script is executed as user privbtch, the script does runs as
follows -- trace file:

**********************************************************************************************************
+ set -x
+ [[ privbtch = privbtch ]]
+ export STORE_HOME=/prod/home01/store/privacy
+ touch 200604231200
/prod/home01/store/privacy/data/privacy_drone_0423.dat
+ touch 200604241200
/prod/home01/store/privacy/data/privacy_drone_0424.dat
+ unset FPATH
+ echo FPATH variable and PATH are not set up yet:
FPATH variable and PATH are not set up yet:
+ echo is FPATH
is FPATH
+ echo
/opt/oracle/product/8.1.7.4/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:

Re: FPATH taking effect but functions not properly invoked

Postby Michael Tosch » Tue, 20 Jun 2006 01:22:41 GMT

ishore wrote:

I see the error is once "purge: not found" and once "purge: cannot execute".

Please define the function at the beginning of your script!


--
Michael Tosch @ hp : com

Similar Threads:

1.Virtual Functions in Shared object not invoked properly by AIX Linker

Compiler used VisualAge C++ Professional / C for AIX Compiler, Version
5

We are getting a strange problem with virtual functions which are not
being bound
to proper address, but the same code is working on Solaris.

The scenario is something like this. I have a shared library (.so)
which has a class with all virtual functions in it.
In the executable, I am creating an object of that class and invoking
its functions.
Eg:-

Class temp
{
	virtual void func1();
	virtual void func2();
	virtual void func3();
};

void temp::func1()
{
	func2();
	func3();
}

void temp::func2()
{
}

void temp::func3()
{
}


In main, I use temp this way

main()
{
	temp myobj;
	myobj.func1();
}

func1 is invoked properly and inside it,the very invocation of func2()
leads to the core dump with a message like

Illegal instruction (illegal opcode) in . at 0x0 ($t15)
warning: Unable to access address 0x0 from core
(dbx) where
warning: Unable to access address 0xfffffffffffffffc from core
warning: Unable to access address 0xfffffffffffffffc from core
warning: Unable to access address 0xfffffffffffffffc from core
warning: Unable to access address 0xfffffffffffffffc from core

.() at 0x0



We had analysed the core dump with the registers command and found the
IAR register containing the NULL address. If the functions func2 and
func3 are changed to non virtual, there is no crash.

Though the example shown is a very miniature version of the actual one,
I think the problem I am facing is understandable with it.

Shared libaries are being build with xlC_r -G option.
Linking is done with -brtl and -bdynamic options.

Any comments and suggestions are welcome.

2.Virtual Functions in Shared object not invoked properly by AIX Linker Inbox

Compiler used VisualAge C++ Professional / C for AIX Compiler, Version
5

We are getting a strange problem with virtual functions which are not
being bound
to proper address, but the same code is working on Solaris.

The scenario is something like this. I have a shared library (.so)
which has a class with all virtual functions in it.
In the executable, I am creating an object of that class and invoking
its functions.
Eg:-

Class temp
{
       virtual void func1();
       virtual void func2();
       virtual void func3();
};

void temp::func1()
{
       func2();
       func3();
}

void temp::func2()
{
}

void temp::func3()
{
}


In main, I use temp this way

main()
{
       temp myobj;
       myobj.func1();
}

func1 is invoked properly and inside it,the very invocation of func2()
leads to the core dump with a message like

Illegal instruction (illegal opcode) in . at 0x0 ($t15)
warning: Unable to access address 0x0 from core
(dbx) where
warning: Unable to access address 0xfffffffffffffffc from core
warning: Unable to access address 0xfffffffffffffffc from core
warning: Unable to access address 0xfffffffffffffffc from core
warning: Unable to access address 0xfffffffffffffffc from core

.() at 0x0



We had analysed the core dump with the registers command and found the
IAR register containing the NULL address. If the functions func2 and
func3 are changed to non virtual, there is no crash.

Though the example shown is a very miniature version of the actual one,
I think the problem I am facing is understandable with it.

Shared libaries are being build with xlC_r -G option.
Linking is done with -brtl and -bdynamic options.

Any comments and suggestions are welcome.

3.crontab -e or crontab -l is not functioning properly

Hello Group!

 I have situation with crontab -e and crontab -l commands not
functioning properly on an Utlra 1 running SUN Solaris 5.8 Patch_Level
is 13. It was
working fine until one of the Windows Admins tried to edit the crontab
file through a text editor instead of vi. He overwrote the original
files
when he saved the changes to the crontab file. So now when you type in
the
commands <crontab -e> or <crontab -l> you get this error message
below:

#ld.so.l:crontab: fatal: relocation error: file crontab: symbol
audit_crontab_not_allowed: referenced symbol not found.
killed
#

Can anyone shead some light to how I can fix this issue with the
crontab
command?

4.[uml-devel] [PATCH 3/4] UML - Properly invoke x86_64 system calls

5.[PATCH 3/4] UML - Properly invoke x86_64 system calls

6. invoking ld(1) with -z ld32=arg when arg takes a comma

7. tcsetattr (on serial device) takes effect only at next application startup

8. PATH takes no effect when login



Return to unix

 

Who is online

Users browsing this forum: No registered users and 31 guest