phyver/GameShell

Mission 29, fails for wrong process name

Mte90 opened this issue · 10 comments

Mte90 commented

immagine
immagine
As you can see in these screens the daemon process is generated with a name truncated so the auto system is not working as fails.
Or manually fails because don't find the daemon but instead it's there.
Maybe as name is too much longer for the process?

https://github.com/phyver/GameShell/blob/master/missions/processes/03_pstree_kill/init.sh#L57

Mte90 commented

I see this on verbose:

gcc -std=c99 -Wall -Wextra -pedantic /home/mte90/Desktop/Prog/GameShell/gameshell/missions/processes/03_pstree_kill/process.c -o /home/mte90/Desktop/Prog/GameShell/gameshell/.tmp/demone_malizioso
/home/mte90/Desktop/Prog/GameShell/gameshell/missions/processes/03_pstree_kill/spell.c:30: error: unterminated #else
   30 | #ifndef GSH_NO_GETTEXT
      | 
/home/mte90/Desktop/Prog/GameShell/gameshell/missions/processes/03_pstree_kill/spell.c:30: error: unterminated #else
   30 | #ifndef GSH_NO_GETTEXT
      | 
    GSH: sourcing $GSH_ROOT/missions/processes/03_pstree_kill/deps.sh
GSH: environment modifications while sourcing $GSH_ROOT/missions/processes/03_pstree_kill/deps.sh
+Function:_mission_init
+Process: 284700 sleep
GSH: environment modifications while sourcing $GSH_ROOT/missions/processes/03_pstree_kill/init.sh
Mte90 commented

There is any update for this?

No, sorry.
I remember dealing with truncated lines at some point, but I have yet to check where, and how.

OK, I think I understand what happens.
ps and pstree truncate the process name to 15 characters.

"demone_malizioso" is thus 1 character too long!
("mischievous_imp" was exactly 15 characters long, so I never saw the problem.)

Asking for the commandline (with ps -f) rather than the process name gives the full path to the executable and it is not truncated.
I don't like that solution because

  • it requires additional arguments to ps
  • scripts end up showing with a leading sh
  • the 2 kinds of "spell" processes can be distinguished without pstree: some come from the imp directory, and some come from the fairy directory`.

The easiest fix would be to replace demone_malizioso by a process name that is less than 15 characters!

A better fix would be to design another mission to illustrate processes hierarchy, but I'm not going to do that anytime soon.

What do you think?

Mte90 commented

I see, the problem in my case is that malizioso has all the synonyms in italian of the same length...

I should change the word with something similar like rogue/rascal but I think that is not the same thing.

Here seems that is possible to get the whole process name with ps https://askubuntu.com/questions/717919/how-to-prevent-ps-from-truncating-the-process-name
Otherwise a solution is to look for a process that start with that string.

Here seems that is possible to get the whole process name with ps https://askubuntu.com/questions/717919/how-to-prevent-ps-from-truncating-the-process-name

Not really, that's the equivalent to using ps -f, which I really don't like.

Otherwise a solution is to look for a process that start with that string.

Ahah...
Does dc688dc, on your branch, work with you?

Mte90 commented

Tested with the latest changes on my branch is still failing:

Hai ucciso il demone?

Spiacente, ma la missione 29 non é stata completata.

/home/mte90/Desktop/Prog/GameShell/gameshell/missions/processes/03_pstree_kill/clean.sh: riga 5: 252385 Ucciso                  "$GSH_TMP/$(gettext "nice_fairy")"
Killed

Crap, it seems to work with me. Do you have commit dc688dc?

Do gsh test and gsh auto fail too? (from the repository)

Mte90 commented

It is working, it was my fault that I didn't generated a new archive.

Perfect!
Let's keep this in your branch.