Check-in [b502b175ea]
Overview
Comment:Ensure relative path with double slashes can be accepted
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b502b175eabb92380471a9f228d0aad344e02a7453007af6ce3aeec6a7c38bb8
User & Date: rkeene on 2020-04-13 20:38:55
Other Links: manifest | tags
Context
2020-04-13
20:43
More tests check-in: 32bd347b13 user: rkeene tags: trunk
20:38
Ensure relative path with double slashes can be accepted check-in: b502b175ea user: rkeene tags: trunk
19:34
Even more sanitizers! check-in: 5b3a8701d2 user: rkeene tags: trunk
Changes

Modified Makefile from [861aa4e744] to [442f001684].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

example-client.o: example.c xvfs-core.h Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_CLIENT $(CFLAGS) -o example-client.o -c example.c

example-client$(LIB_SUFFIX): example-client.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client$(LIB_SUFFIX) example-client.o $(LIBS) $(TCL_STUB_LIB)

example-flexible.o: example.c xvfs-core.h Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example-flexible.o -c example.c

example-flexible$(LIB_SUFFIX): example-flexible.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-flexible$(LIB_SUFFIX) example-flexible.o $(LIBS) $(TCL_STUB_LIB)

xvfs.o: xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_SERVER $(CFLAGS) -o xvfs.o -c xvfs-core.c







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

example-client.o: example.c xvfs-core.h Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_CLIENT $(CFLAGS) -o example-client.o -c example.c

example-client$(LIB_SUFFIX): example-client.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-client$(LIB_SUFFIX) example-client.o $(LIBS) $(TCL_STUB_LIB)

example-flexible.o: example.c xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_FLEXIBLE $(CFLAGS) -o example-flexible.o -c example.c

example-flexible$(LIB_SUFFIX): example-flexible.o Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o example-flexible$(LIB_SUFFIX) example-flexible.o $(LIBS) $(TCL_STUB_LIB)

xvfs.o: xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_SERVER $(CFLAGS) -o xvfs.o -c xvfs-core.c

Modified example/main.tcl from [473c237929] to [5057e2018f].

234
235
236
237
238
239
240




241
242
243
244
245
246
247
tcltest::test xvfs-glob-hidden "Xvfs Glob Hidden Test " -body {
	glob -nocomplain -directory $rootDir -types hidden *
} -result ""

tcltest::test xvfs-glob-executable "Xvfs Glob Executable Test " -body {
	glob -nocomplain -directory $rootDir -types x *
} -result $rootDir/lib





tcltest::test xvfs-access-basic-read "Xvfs acccess Read Basic Test" -body {
	file readable $testFile
} -match boolean -result true

tcltest::test xvfs-access-basic-write "Xvfs acccess Write Basic Test" -body {
	file writable $testFile







>
>
>
>







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
tcltest::test xvfs-glob-hidden "Xvfs Glob Hidden Test " -body {
	glob -nocomplain -directory $rootDir -types hidden *
} -result ""

tcltest::test xvfs-glob-executable "Xvfs Glob Executable Test " -body {
	glob -nocomplain -directory $rootDir -types x *
} -result $rootDir/lib

tcltest::test xvfs-glob-trailing-slash-1 "Xvfs Glob Trailing Slash Test" -body {
	llength [glob -nocomplain -directory $rootDir/ *]
} -result 3

tcltest::test xvfs-access-basic-read "Xvfs acccess Read Basic Test" -body {
	file readable $testFile
} -match boolean -result true

tcltest::test xvfs-access-basic-write "Xvfs acccess Write Basic Test" -body {
	file writable $testFile

Modified xvfs-core.c from [acc58f104b] to [514749566d].

129
130
131
132
133
134
135





136
137
138
139
140
141
142
143
	}

	while (pathLen >= 2 && memcmp(pathFinal, "./", 2) == 0) {
		pathFinal += 2;
		pathLen   -= 2;
	}






	XVFS_DEBUG_PRINTF("... relative path: \"%s\"", pathFinal);

	XVFS_DEBUG_LEAVE;
	return(pathFinal);
}

static int xvfs_errorToErrno(int xvfs_error) {
	if (xvfs_error >= 0) {







>
>
>
>
>
|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	}

	while (pathLen >= 2 && memcmp(pathFinal, "./", 2) == 0) {
		pathFinal += 2;
		pathLen   -= 2;
	}

	while (pathLen >= 1 && pathFinal[0] == '/') {
		pathFinal += 1;
		pathLen   -= 1;
	}

	XVFS_DEBUG_PRINTF("... relative path: \"%s\" (pathLen = %i)", pathFinal, pathLen);

	XVFS_DEBUG_LEAVE;
	return(pathFinal);
}

static int xvfs_errorToErrno(int xvfs_error) {
	if (xvfs_error >= 0) {