[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

132.0. "Strange Use of f$pid Lexical" by VAXUUM::DYER () Sun Jul 28 1985 00:43

	In a previous note, somebody hacked at a DCL command procedure with
a strange use of f$pid.  It was used like this:

			'f$pid("GOTO")'

What does this do?
		<_Jym_>
T.RTitleUserPersonal
Name
DateLines
132.1WEBSTR::NELSONSun Jul 28 1985 16:153
It generates the DCL error ARGREQ on VMS V4.1

				JENelson
132.2RANI::LEICHTERJSun Aug 04 1985 23:5128
What you meant - executing a DWIM for you :-) - was:

	'f$pid(GOTO)'

The f$pid() function steps through successive processes on the system.  The
way you are supposed to use it is:

	$ context = ""
	$loop:
	$ next_pid = f$pid(context)
	$ if next_pid .eqs. "" then goto done
		... do what you want with the process whose pid is in next_pid
	$ goto loop
	$done:

The symbol passed to f$pid() is used by DCL to store context so that on the
next call you will get the next pid.  On the first call, the symbol should
either be the null string, or undefined.  I think what actually gets stored in
context is the pid returned, but that may have changed since V3 days, and I may
remember it wrong anyway.

So, the effect of the f$pid(GOTO) call is to define the symbol GOTO as some
random string.  Should the procedure in which this occurs have a GOTO in it
anywhere - say, in an ON CONTROL_Y GOTO ... - trying to execute it will produce
severe DCL problems.  This allows you to break into any DCL procedure that in
any way lets you force it to execute arbitrary text you type in.

							-- Jerry
132.3BIZET::BARABASHFri Aug 30 1985 17:1620
  A real lexical function obscurity that I came across follows.

  According to the great DCL dictionary (page DCL-348):
	"You can truncate function names to any unique abbreviation."

  Also, (page DCL-419):
	"F$USER returns the current user identification code (UIC)...

	 RETURN VALUE A character string containing the current user
		      identification (UIC), including square brackets.
		      The UIC is returned in the format [group-identifier,
		      member-identifier]."

  The minimal unique abbreviation of the lexical function F$USER is F$U.

  QUESTION:  What does the following statement do?

	$ write sys$output f$u()

  -- Bill B.
132.4R2ME2::GILBERTFri Aug 30 1985 19:042
Bill -
	May we assume you've entered a QAR on this?
132.5DVINCI::FISHERTue Sep 10 1985 17:236
Aaah....am I being dense?  On V4.2, Write Sys$output f$u() causes the UIC
string to be written to sys$output.  That is what I would expect.  Did you
expect something different?

Burns

132.6TURTLE::GILBERTTue Sep 10 1985 18:421
On V4.1, it writes the default directory; i.e., same as f$directory().
132.7BEECH::ECKERTTue Sep 10 1985 20:528
re: .6

Are you sure it's not giving you the symbolic form of the UIC (i.e., the
rights identifier assigned to the username)?

Try SHOW SYSTEM/FULL.

	- Jerry
132.8BEECH::ECKERTTue Sep 10 1985 20:555
re: .6, .7

I forgot to mention that the identifier [abc,xyz] is equivalent to [xyz].

	- Jerry
132.9WEBSTR::NELSONTue Sep 10 1985 21:314
On MY V4.2 system, F$U() prints out the default directory.  F$US() properly
prints the UIC.

				JENelson
132.10THRINT::WARWICKWed Sep 11 1985 05:134
	I get the same results as Mr. JENelson


Trev
132.11DVINCI::FISHERWed Sep 11 1985 11:556
Oops...it does that for me too.  I was in a subdirectory at the which happened
to be very similar to the UIC identifier.  I just missed the fact that it
was [X.Y] rather than [X,Y].

Burns

132.12f$u() still sick in Vms v4.5 ...PILOU::BONGARTZHappy HackerFri Apr 17 1987 05:151
132.13And in 4.6MDVAX3::COARA wretched hive of bugs and flamers.Fri Oct 30 1987 11:070