Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
78 user(s) are online (54 user(s) are browsing Forums)

Members: 1
Guests: 77

jaokim, more...

Support us!

Headlines

 
  Register To Post  

SED does not produce output within SH on X5000 but does with X1000 [SOLVED]
Quite a regular
Quite a regular


See User information
I have the following script:
.KEY PAT/F
.BRA {
.
KET }
.DEFAULT 
PAT "(#?.c|#?.h|#?.cpp|#?.hpp|#?.hh|#?.cc|#?.cxx|#?.hxx)"
set CTAGS_LOC=Programs:ctags-5.8/ctags

IF EXISTS ${CTAGS_LOC}
    ${
CTAGS_LOC} -NR --format=--sort=no `SEARCH "" {PAT} FILE PATTERN ALL`
    
sh -"head -n 6 tags > RAM:T/tags_h6 ; tail +7 tags > RAM:T/tags_t6 ; Workbench:C/SORT RAM:T/tags_t6 RAM:T/tags_sorted CASE ; sed -i -n 's|\([A-Za-z]\+\):|/\1/|p' RAM:T/tags_sorted ; cat RAM:T/tags_h6 RAM:T/tags_sorted > tags"
    
delete >NILRAM:T/tags_h6 RAM:T/tags_t6 RAM:T/tags_sorted 
ELSE
    echo 
"Location of ${CTAGS_LOC} not found"
ENDIF


I have the same version of all of the programs being used in the script. And I find my self in the same old situation again: "It works on the X1000, but not the X5000!?"

If I go into some root project directory with source files and run "ctags" on the X1000, I get my CTAGS all populated and ready, on the X5000 with the very same script, with the very same tools, at the very same versions, I just get the top 6 lines of CTAGS meta-data!

Can someone else try this. You will just need to run protect +s and also install ctags (OS4Depot) and change the LOC of your ctags accordingly.

I just love these WTH moments.

==

So far, on the X5000 when I break things down, it seems to be the SED script that fails on the X5000, yet it works on the X1000 .... :S

==

I also I am not interested in improvements or questions of why I am doing things a certain way. By all means, lecture me later, I just firstly want to know why there is a difference here.


Edited by rjd324 on 2022/8/27 20:44:31
Edited by rjd324 on 2022/8/27 21:30:46
If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: Yet Another WTH Moment
Quite a regular
Quite a regular


See User information
Okay, well... for whatever reason the issue seems to be running SED within SH.

I can run that SED within Amiga "Shell" on both machines, and I get the same results, but, within Amiga "Shell" -> within "SH" -> running SED produces no output on my X5000, but it works on the X1000.

My reproducible steps are:

1 - Copy the following contents into any file:
!_TAG_FILE_FORMAT    1    /original ctags format/
!
_TAG_FILE_SORTED    0    /0=unsorted1=sorted2=foldcase/
!
_TAG_PROGRAM_AUTHOR    Darren Hiebert    /dhiebert@users.sourceforge.net/
!
_TAG_PROGRAM_NAME    Exuberant Ctags    //
!_TAG_PROGRAM_URL    http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION    5.8    //
BAIL    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define BAIL(/
PI    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define PI /
TO_DEG    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define TO_DEG(/
WIDTH    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define WIDTH    /
HEIGHT    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define HEIGHT /
FRAME_S    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define FRAME_S    /
PER_SEC    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define PER_SEC(/
SEC    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define SEC(/
VEL_X    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define VEL_X    /
VEL_Y    Other:Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define VEL_Y    /


2. CD into the directory containing that file

3. run the following command in Amiga Shell:
sed -"s|\([A-Za-z]\+\):|/\1/|p" tags1


4. See that the output is:
!_TAG_PROGRAM_URL    /http///ctags.sourceforge.net    /official site/
BAIL    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define BAIL(/
PI    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define PI /
TO_DEG    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define TO_DEG(/
WIDTH    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define WIDTH    /
HEIGHT    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define HEIGHT /
FRAME_S    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define FRAME_S    /
PER_SEC    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define PER_SEC(/
SEC    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define SEC(/
VEL_X    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define VEL_X    /
VEL_Y    /Other/Dev/SVN_AMIGA/SWAG2022/bak3.c    /^#define VEL_Y    /


5. From that shell, no go into "SH" by executing:
sh


6. Run the same SED command:
sed -"s|\([A-Za-z]\+\):|/\1/|p" tags1


7. Notice that there is no output

===

Wondering if anyone else can agree with my Step 7. On my X1000 step 7 produces the same output as step 4.

The file sizes and versions of SH and SED are the same on both machines.

If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: SED does not produce output within SH on X5000 but does with X1000 (program version are the same)
Quite a regular
Quite a regular


See User information
What is also interesting is that the X1000 opens up:

00058 : sed             o.k. = [execOpenLibrary("dos.library",37) [8uS]
00059 : 
sed             o.k. = [execOpenLibrary("utility.library",37) [3uS]


Where as the X5000 opens up:

00018 : sed o.k. = [execOpenLibrary("newlib.library",52) [4uS]


This was checked using Snoopy.

If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: SED does not produce output within SH on X5000 but does with X1000 (program version are the same)
Quite a regular
Quite a regular


See User information
Okay, that seems to be it.

For whatever reason, in within SH within Amiga Shell on the X5000, SED is opening up "newlib". When running SED just withing Amiga Shell it opens up "utility" and "dos".

On the X1000 it opens up "utility" and "dos" no matter if just running through Amiga Shell or Amiga Shell->SH.

At this point, I need someone more qualified than me to explain why this is happening.

If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: SED does not produce output within SH on X5000 but does with X1000 (program version are the same)
Quite a regular
Quite a regular


See User information
Okay, what an ordeal.

So, when in SH on the X5000 I noticed - thanks to Snoopy - that it was running SED from AmiCygnix instead of the one in the SDK which is very interesting because when in SH:
which sed

Bring back:
Programs:SDK/local/C/sed

I am afraid that is lies, and not how "which" should behave.
echo $PATH

Returns:
/Cygnix/CygnixPPC/gtk2.24/bin:/Cygnix/CygnixPPC/local/bin:/Cygnix/CygnixPPC/bin:/Cygnix/CygnixPPC/X11R6.3/bin:/gcc/bin:/SDK/C:/SDK/Local/C:/SDK/Local/newlib/bin:/SDK/Local/clib2/bin:/C:.


And, "sed" is in "/Cygnix/CygnixPPC/bin/sed" before "/SDK/Local/C".

So now, I guess we cannot trust even "which".

===

Edit: Actually, "which" is an Amiga program, so when I said "not how which should behave" I assumed I was using a linux version of which.

===

Okay, wow.

The reason "which sed" is bringing back SDK/Local/C is because - yes, it is the Amiga version, and for me, the SDK/Local/C is BEFORE the AmiCygnix WITHIN the Amiga environment context (i.e. typing "PATH" in AmigaShell)

It was kind of my mistake. I forgot that "which" was not a core-utils thing, and it is an Amiga application.

So - finally - all of this makes sense!

===

Now, I need to figure out where SH gets its PATH from, and why the Amiga path is not honoured.


Edited by rjd324 on 2022/8/27 21:54:58
If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: SED does not produce output within SH on X5000 but does with X1000 (program version are the same)
Just can't stay away
Just can't stay away


See User information
@rjd324

The Amiga version of Which supports the ALL switch which will show you all the instances of the program in question, listed in the order they are found in the (AmigaOS) search path. When in doubt, I find this useful to check whether you do actually have the version you thought, but later in the path.

As for sh's path, I believe it is using the $PATH variable and not the AmigaOS path. Not sure how the initial contents of $PATH are set in a standard SDK installation.

Best regards,

Niels

Go to top
Re: SED does not produce output within SH on X5000 but does with X1000 [SOLVED]
Quite a regular
Quite a regular


See User information
@nbache

Thank you. I will remember that.

If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project