Operating System - OpenVMS
1753918 Members
7379 Online
108810 Solutions
New Discussion юеВ

Re: Error accessing authorization file

 
Wim Van den Wyngaert
Honored Contributor

Re: Error accessing authorization file

Correct John. My first guess was that it was the set file on the files themselves. But after checking what the script did I found it also changed directories.

Wim
Wim
Jon Pinkley
Honored Contributor

Re: Error accessing authorization file

Wim,

What version of VMS are you using?

To me this seems like a bug in the implementation of the f$search lexical function, especially if it isn't returning an error status. Can you supply a reproducer?

Jon
it depends
Wim Van den Wyngaert
Honored Contributor

Re: Error accessing authorization file

Job,

These are the 2 jobs you have to submit. The 2nd one will loop until the first one is submitted. The .dir file is my home directory.

IMO lexicals handle open files badly. I'm on 7.3.

$b:
$ on warning then exit
$ set file ops$mgr:[000000]wvw.dir /prot=(w:rwed)/own=sysmgr_wvw
$ goto b


$b:
$ if f$sea("OPS$MGR:[WVW]wim.lis") .eqs. "" then exit
$ x=f$sea("login.com") !reset
$ goto b

Wim
Wim
Hein van den Heuvel
Honored Contributor

Re: Error accessing authorization file

Just a few observations.

1) The behaviour is the same under OpenVMS 8.3

2) The error is trapped by RMS. DCL chooses to ignore it.

The full errors are:
STS: %RMS-E-FLK, file currently locked by another user
STV: %SYSTEM-W-ACCONFLICT, file access conflict

3) Strictly speaking this is correct.
- The directory file is open for write.

4) You can 'see' the error happen with SET WATCH FILE/CLASS=ALL

good:

%XQP, Thread #0, Volume protection: Access requested: 00000001, Status: 00000001, PrvUsd: 00000000
%XQP, Thread #0, File protection (101369,44,0): Access requested: 00000004, Status: 00000001, PrvUsd: 00000000
%XQP, Thread #0, Read only directory access (101369,44,0)
%XQP, Thread #0, Directory scan for: TMP.TMP;0, Status: 00000001
%XQP, Thread #0, Lookup (114092,113,0) Status: 00000001

bad:

%XQP, Thread #0, Volume protection: Access requested: 00000001, Status: 00000001, PrvUsd: 00000000
%XQP, Thread #0, File protection (101369,44,0): Access requested: 00000004, Status: 00000001, PrvUsd: 00000000
%XQP, Thread #0, Lookup (0,0,0) Status: 00000800

Reproducer in C below.

Cheers,
Hein.

$! --- l1.com ---
$i = 0
$on warning then exit
$loop:
$i = i + 1
$set file tmp.dir/prot=w:rwe/own=hein
$if i .eq. 1000*(i/1000) then write sys$output i
$goto loop

$! ---- l2.com ----
$i = 0
$on warning then exit
$loop:
$i = i + 1
$if f$search("[.tmp]tmp.tmp;0").eqs."" then goto done
$x = f$search("sys$login:login.com")
$if i .eq. 1000*(i/1000) then write sys$output i
$goto loop
$done:
$write sys$output i
$exit


/* l2.c. Hein van den Heuvel
** usage: $mcr dev:[dir]l2 [.sub]file.ext
*/
#include string
#include stdio
#include fab
#include nam

main(int argc, char *argv[]) {

int stat = 1, i = 0, sys$parse(), sys$search();
struct FAB fab = cc$rms_fab;
struct NAM nam = cc$rms_nam;
char esa[256], rsa[256], *func;

fab.fab$l_fna = argv[1];
fab.fab$b_fns = strlen(argv[1]);
fab.fab$l_nam = &nam;

nam.nam$l_esa = (char *) esa;
nam.nam$b_ess = 255;
nam.nam$l_rsa = (char *) rsa;
nam.nam$b_rss = 255;

while (1 & stat) {
if (!(++i % 1000)) printf ("%d\n",i);
func = "parse";
stat = sys$parse ( &fab ) ;
if ( 1 & stat ) {
func = "search";
stat = sys$search ( &fab );
}
}
printf ("i=%d, %s, sts=%d, stv=%d\n", i, func, fab.fab$l_sts, fab.fab$l_stv);
return stat;
}