From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) From: arisawa In-Reply-To: Date: Tue, 22 Dec 2015 19:02:55 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: <23396C1E-C0AC-4DC5-B511-97B307ECB3A4@ar.aichi-u.ac.jp> References: <73CCEA09-C492-439D-9E8A-AA2BA9CB93DB@ar.aichi-u.ac.jp> <5E232682-7ABD-4564-96C1-89B1540FC4E2@ar.aichi-u.ac.jp> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] bug in exportfs Topicbox-Message-UUID: 7adb6490-ead9-11e9-9d60-3106f5b1d025 No. The difficulty is in the pattern matching rule. If we want to export only /usr/glenda, then the pattern matching filer = must pass /usr /usr/glenda and must not pass /usr/ have you get solution? > 2015/12/22 18:25=E3=80=81Peter Hull = =E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB=EF=BC=9A >=20 > Mr Arisawa, > Did you get any answers to this? > Peter >=20 >=20 > On Thu, 17 Dec 2015 at 13:06 arisawa wrote: > Thanks for your replay. > however I don=E2=80=99t understand the intention of the manual. > real needs in exporting is to export some different directories. > it is impossible to do so under current code. > can anyone show an example that exports two or more directories? >=20 > > 2015/12/17 20:40=E3=80=81Peter Hull = =E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB=EF=BC=9A > > > > On Wed, Dec 16, 2015 at 11:31 PM, arisawa = wrote: > >> It seems cpu command is buggy in -P option. > >> the sources of the problem is in command option -P of exportfs. > > > > I had a look at the manpage for exportfs(4), it says: "For a file to > > be exported, all lines with a prefix + must match and all those with > > prefix - must not match." (http://man.9front.org/4/exportfs) > > > > So isn't the original code correct according to the manpage? If any = of > > the regexps in 'include' fail to match, the function returns -1, = then > > if any in 'exclude' do match, -1 is returned. > > > >> patternfile sample > >> + /usr/arisawa > >> + /usr/glenda > >> - /adm > >> - /sys/log > >> - /mail > >> - /usr/.* > >> > > Is this sample invalid - no path could match /usr/arisawa and > > /usr/glenda at the same time? > > > > Pete >=20 > I said: >=20 > > int > > excludefile(char *path) > > { > > Reprog **re; > > char *p; > > > > if(*(path+1) =3D=3D 0) > > p =3D "/"; > > else > > p =3D path+1; > > > > DEBUG(DFD, "checking %s\n", p); > > for(re =3D include; *re !=3D nil; re++){ > > - if(regexec(*re, p, nil, 0) !=3D 1){ > > + if(regexec(*re, p, nil, 0) =3D=3D 1){ > > DEBUG(DFD, "excluded+ %s\n", p); > > - return -1; > > + return 0; > > } > > } > > for(re =3D exclude; *re !=3D nil; re++){ > > if(regexec(*re, p, nil, 0) =3D=3D 1){ > > DEBUG(DFD, "excluded- %s\n", p); > > return -1; > > } > > } > > return 0; > > } > > > > > > patternfile sample > > + /usr/arisawa > > + /usr/glenda > > - /adm > > - /sys/log > > - /mail > > - /usr/.* >=20 > however this code has still a problem. >=20 > trailing =E2=80=98/=E2=80=98 is removed in p even if p is a directory. > assume we have users: > /usr/rob > and > /usr/robin > then we cannot export only /usr/rob. > if we wish control this problem, we need tailing =E2=80=98/=E2=80=98 = for directory. > then the code should be >=20 > excludefile(char *path) > { > Reprog **re; > char *p,*s; > Dir *dir; >=20 > if(*(path+1) =3D=3D 0) > p =3D "/"; > else > p =3D path+1; >=20 > s =3D p + strlen(p) - 1; /* tail */ > dir =3D dirstat(p); > /* should not be nil */ > if((dir->mode)&DMDIR){ > /* we have room to append '/' > * look makepath() in exportfs.c */ > *++s =3D '/'; > *++s =3D 0; > } >=20 > DEBUG(DFD, "checking %s\n", p); > for(re =3D include; *re !=3D nil; re++){ > if(regexec(*re, p, nil, 0) =3D=3D 1){ > DEBUG(DFD, "excluded+ %s\n", p); > return 0; > } > } > for(re =3D exclude; *re !=3D nil; re++){ > if(regexec(*re, p, nil, 0) =3D=3D 1){ > DEBUG(DFD, "excluded- %s\n", p); > return -1; > } > } > return 0; > } >=20 > then patternfile sample become: >=20 > + /usr/arisawa/.* > + /usr/glenda/.* > - /adm/ > - /sys/log/ > - /mail/ > - /usr/.+ >=20 > adding tailing =E2=80=98/=E2=80=98 in p makes the pattern file = incompatible to existing one. > I don=E2=80=99t know it is better to do so. >=20 >=20 >=20