Opened 17 years ago

Last modified 13 years ago

#1994 assigned defect

msLoadMap does not properly close map files on parse error

Reported by: scott.e@… Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc: hobu

Description (last modified by hobu)

We use C# mapscript on Windows and have been seeing behavior where a map file is
locked by the process that calls msLoadMap.  Thus the file cannot be delete
until the process is finished.  This is only occurs on parse error, and is
because fclose() is not properly called in these circumstances.

Attached is a patch which rectifies this by calling fclose() in all circumstances.

Attachments (4)

fclose.patch (1.2 KB ) - added by scott.e@… 17 years ago.
patch
mapfile.c.patch (1.4 KB ) - added by scott.e@… 17 years ago.
corrected patch
mapfile.c.2.patch (1.9 KB ) - added by scott.e@… 17 years ago.
newlines fixed patch
mapfile.c.4.patch (1.4 KB ) - added by scott.e@… 17 years ago.
strip custom stuff

Download all attachments as: .zip

Change History (13)

by scott.e@…, 17 years ago

Attachment: fclose.patch added

patch

by scott.e@…, 17 years ago

Attachment: mapfile.c.patch added

corrected patch

comment:1 by sdlime, 17 years ago

Will apply at first opportunity...

Steve

comment:2 by sdlime, 17 years ago

Status: newassigned
Scott: Applying the patch failed for me for both 4.10 and CVS HEAD. What version
are you using?

Steve

by scott.e@…, 17 years ago

Attachment: mapfile.c.2.patch added

newlines fixed patch

comment:3 by scott.e@…, 17 years ago

attachments.isobsolete: 01

comment:4 by scott.e@…, 17 years ago

attachments.isobsolete: 01

comment:5 by sdlime, 17 years ago

There's still a problem. Looks like the patch contains some extraneous stuff
that must be custom for you. The patch applies ok but won't compile (against CVS
HEAD). I'm getting:

mapfile.c:2636: error: `MS_SQLSPATIAL' undeclared (first use in this function)
mapfile.c:2636: error: (Each undeclared identifier is reported only once
mapfile.c:2636: error: for each function it appears in.)
mapfile.c: In function `loadMapInternal':
mapfile.c:4571: warning: unused variable `i'
mapfile.c:4571: warning: unused variable `j'
mapfile.c:4571: warning: unused variable `k'
mapfile.c:4572: warning: unused variable `szPath'
mapfile.c:4572: warning: unused variable `szCWDPath'
mapfile.c: In function `ParseMap':
mapfile.c:4604: error: argument `filename' doesn't match prototype
mapfile.c:229: error: prototype declaration
mapfile.c:4604: error: argument `new_mappath' doesn't match prototype
mapfile.c:229: error: prototype declaration
mapfile.c:4629: warning: passing arg 1 of `strdup' makes pointer from integer
without a cast
mapfile.c:4631: warning: passing arg 1 of `getPath' makes pointer from integer
without a cast
mapfile.c: In function `msLoadMap':
mapfile.c:4835: warning: unused variable `starttime'
mapfile.c:4835: warning: unused variable `endtime'

Steve

by scott.e@…, 17 years ago

Attachment: mapfile.c.4.patch added

strip custom stuff

comment:6 by scott.e@…, 17 years ago

attachments.isobsolete: 01

comment:7 by hobu, 17 years ago

Cc: hobu added
Description: modified (diff)

Steve,

What's the status on this one? I know you've been reworking a lot of things for the 5.0 release, and I was wondering if these patches or something like it have made it into trunk yet.

Howard

comment:8 by hobu, 17 years ago

r6197 and r6200 are a few changesets attempting to reconcile this issue. More changes likely forthcoming for FONTSET and SYMBOLs.

comment:9 by sdlime, 13 years ago

I've no clue if this is still an issue. I'd love to close if anyone knows definitively...

Steve

Note: See TracTickets for help on using tickets.