madden (11/25/82)
As distributed, the 4.1BSD pascal compiler (pc) will destroy or completely remove the file associated with a source argument name longer that 14 characters. If the long argument ends with ".p", the compiler generates the corresponding object file name by replacing the "p" with an "o" without attention to the fact that the file system entry for the two names will be the same. The result is immediate disaster. We have some naive students here who have been burned by the scenario: ex program3.source.p . . . wq pc program3.source.p This sequence generates no complaints from ex or pc, even though the file name actually created is "program3.sourc"; unfortunately, after a successful compile, a.out exists but "program3.sourc" has disappeared. As an expedient solution, I have patched /usr/src/cmd/pascal/pc.c to generate a complaint and quit as shown by the diff at the end of this note. Jim Madden UCSD Computer Center ucbvax!sdcsvax!madden ------- pc.c ------- *** /tmp/d23229 Thu Nov 25 02:21:21 1982 --- pc.c Wed Nov 24 18:52:05 1982 *************** *** 185,190 savargx = pc0argx; for (i = 0; i < argc; i++) { argp = argv[i]; if (argp[0] == '-') continue; if (suffix(argp) == 's') { --- 185,196 ----- savargx = pc0argx; for (i = 0; i < argc; i++) { argp = argv[i]; + if (strlen(argp)>14) { + fprintf(stderr, + "pc: file names must be <= 14 characters long (%s)\n" + ,argv[i]); + exit(1); + } if (argp[0] == '-') continue; if (suffix(argp) == 's') {