file:delete() and hidden files on Mac OS
Thursday, 27 February 2014 · 6 messages
FB
France Baril27 Feb 2014 03:46 #
Hi,
I need to be able to export content to a clean directory. When I export content to a directory that used to exist, I need to wipe and clean to replace everything with new content.
However, I am getting io-errors: Stopped at
/Applications/basex/webapp/How2_StaticHTML.xqm, 738/30:
[io-error] Path '/.DocumentRevisions-V100' cannot be deleted.
Is there anyway from the basex side to allow deletion of hidden files or do I have to disable revisions on my computer, so these files never get created in the first place? The second option seems rather drastic.
--
France Baril
Architecte documentaire / Documentation architect
france.baril at architextus.com
(514) 572-0341
DK
Dirk Kirsten27 Feb 2014 10:14 #
Hello France,
are you sure you have the required rights to deleted this file with the user executing BaseX?
Id did a quick test and had not trouble deleted a hidden file. Furthermore, I did a quick look into the code and deleting works using the java.io.file.delete() function, so its seems not to be related to BaseX.
Cheers,
Dirk
Quoted text · France Baril · 25 lines
On 27/02/14 02:46, France Baril wrote: > Hi, > > I need to be able to export content to a clean directory. When I export > content to a directory that used to exist, I need to wipe and clean to > replace everything with new content. > > However, I am getting io-errors: Stopped at > > /Applications/basex/webapp/How2_StaticHTML.xqm, 738/30: > > [io-error] Path '/.DocumentRevisions-V100' cannot be deleted. > > Is there anyway from the basex side to allow deletion of hidden files or do > I have to disable revisions on my computer, so these files never get > created in the first place? The second option seems rather drastic. > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
JE
Jens Erat27 Feb 2014 10:20 #
If you want to completely wipe a directory, I’d go for deleting and recreating the directory itself anyway (given you can write to the parent folder).
Yet I’m still curios about the path in the error message, are you really trying to wipe the file system root or did you remove some part of the path?
--
Jens Erat
[phone]: tel:+49-151-56961126
[mail]: mailto:email at jenserat.de
[jabber]: xmpp:jabber at jenserat.de
[web]: http://www.jenserat.de
PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Quoted text · Dirk Kirsten · 48 lines
Am 27.02.2014 um 10:14 schrieb Dirk Kirsten <dk at basex.org>: > Hello France, > > are you sure you have the required rights to deleted this file with the > user executing BaseX? > Id did a quick test and had not trouble deleted a hidden file. > Furthermore, I did a quick look into the code and deleting works using > the java.io.file.delete() function, so its seems not to be related to BaseX. > > Cheers, > Dirk > > On 27/02/14 02:46, France Baril wrote: >> Hi, >> >> I need to be able to export content to a clean directory. When I export >> content to a directory that used to exist, I need to wipe and clean to >> replace everything with new content. >> >> However, I am getting io-errors: Stopped at >> >> /Applications/basex/webapp/How2_StaticHTML.xqm, 738/30: >> >> [io-error] Path '/.DocumentRevisions-V100' cannot be deleted. >> >> Is there anyway from the basex side to allow deletion of hidden files or do >> I have to disable revisions on my computer, so these files never get >> created in the first place? The second option seems rather drastic. >> >> >> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
DK
Hi France,
as Jens correctly pointed out your file path "/.DocumentRevisions-V100" looks rather suspicious and I guess you neither want to delete this file nor you can without sudo rights. This is in the root folder and in general you don't want to delete these files as it could corrupt your system. Are you _really_ sure you want to delete these files?
This also explains why you can delete .DS_Store files as these should be deleteable with normal user privileges. Maybe there is a symlink within your folder to this directory (I don't have OS X nor do I have any knowledge about it, so I actually have no idea). I very much doubt that an update to BaseX 7.8 (or now to 7.8.1) did make any difference as this is file system related. If you upgraded your OS, this could in fact make a difference (once again: I guess, as this is OS X specific).
Please take a look at the file permissions and check if the user has the required permissions to delete this file.
Cheers,
Dirk
Quoted text · France Baril · 100 lines
On 27/02/14 19:49, France Baril wrote: > Hi, > > I can delete the .DS_Store hidden file, but apparently not the version > file. > > The code has nothing special: > > *if* (*file:exists*(*$file-sys-destination*)) > *then **file:delete*(*$file-sys-destination*, *true*()) > *else *() > > > where $file-sys-destination is a path to a folder in the form > publication/model/os/carrier/lang. > > > I upgraded to Maverick and to BaseX 7.8 at 2 days interval so I'm not 100% > sure which one is making a difference here. I'll run some more tests once I > get 7.8.1 running. I'm still on 7.8. > > > > > On Thu, Feb 27, 2014 at 4:20 AM, Jens Erat <jens.erat at uni-konstanz.de>wrote: > >> If you want to completely wipe a directory, I’d go for deleting and >> recreating the directory itself anyway (given you can write to the parent >> folder). >> >> Yet I’m still curios about the path in the error message, are you really >> trying to wipe the file system root or did you remove some part of the path? >> >> -- >> Jens Erat >> >> [phone]: tel:+49-151-56961126 >> [mail]: mailto:email at jenserat.de >> [jabber]: xmpp:jabber at jenserat.de >> [web]: http://www.jenserat.de >> >> PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B >> >> >> >> Am 27.02.2014 um 10:14 schrieb Dirk Kirsten <dk at basex.org>: >> >>> Hello France, >>> >>> are you sure you have the required rights to deleted this file with the >>> user executing BaseX? >>> Id did a quick test and had not trouble deleted a hidden file. >>> Furthermore, I did a quick look into the code and deleting works using >>> the java.io.file.delete() function, so its seems not to be related to >> BaseX. >>> >>> Cheers, >>> Dirk >>> >>> On 27/02/14 02:46, France Baril wrote: >>>> Hi, >>>> >>>> I need to be able to export content to a clean directory. When I export >>>> content to a directory that used to exist, I need to wipe and clean to >>>> replace everything with new content. >>>> >>>> However, I am getting io-errors: Stopped at >>>> >>>> /Applications/basex/webapp/How2_StaticHTML.xqm, 738/30: >>>> >>>> [io-error] Path '/.DocumentRevisions-V100' cannot be deleted. >>>> >>>> Is there anyway from the basex side to allow deletion of hidden files >> or do >>>> I have to disable revisions on my computer, so these files never get >>>> created in the first place? The second option seems rather drastic. >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basex.org >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> > >
--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
FB
Hi,
I can delete the .DS_Store hidden file, but apparently not the version file.
The code has nothing special:
*if* (*file:exists*(*$file-sys-destination*))
*then **file:delete*(*$file-sys-destination*, *true*())
*else *()where $file-sys-destination is a path to a folder in the form publication/model/os/carrier/lang.
I upgraded to Maverick and to BaseX 7.8 at 2 days interval so I'm not 100% sure which one is making a difference here. I'll run some more tests once I get 7.8.1 running. I'm still on 7.8.
On Thu, Feb 27, 2014 at 4:20 AM, Jens Erat <jens.erat at uni-konstanz.de>wrote:
Quoted text · Jens Erat · 72 lines
> If you want to completely wipe a directory, I’d go for deleting and > recreating the directory itself anyway (given you can write to the parent > folder). > > Yet I’m still curios about the path in the error message, are you really > trying to wipe the file system root or did you remove some part of the path? > > -- > Jens Erat > > [phone]: tel:+49-151-56961126 > [mail]: mailto:email at jenserat.de > [jabber]: xmpp:jabber at jenserat.de > [web]: http://www.jenserat.de > > PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B > > > > Am 27.02.2014 um 10:14 schrieb Dirk Kirsten <dk at basex.org>: > > > Hello France, > > > > are you sure you have the required rights to deleted this file with the > > user executing BaseX? > > Id did a quick test and had not trouble deleted a hidden file. > > Furthermore, I did a quick look into the code and deleting works using > > the java.io.file.delete() function, so its seems not to be related to > BaseX. > > > > Cheers, > > Dirk > > > > On 27/02/14 02:46, France Baril wrote: > >> Hi, > >> > >> I need to be able to export content to a clean directory. When I export > >> content to a directory that used to exist, I need to wipe and clean to > >> replace everything with new content. > >> > >> However, I am getting io-errors: Stopped at > >> > >> /Applications/basex/webapp/How2_StaticHTML.xqm, 738/30: > >> > >> [io-error] Path '/.DocumentRevisions-V100' cannot be deleted. > >> > >> Is there anyway from the basex side to allow deletion of hidden files > or do > >> I have to disable revisions on my computer, so these files never get > >> created in the first place? The second option seems rather drastic. > >> > >> > >> > >> > >> _______________________________________________ > >> BaseX-Talk mailing list > >> BaseX-Talk at mailman.uni-konstanz.de > >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >> > > > > -- > > Dirk Kirsten, BaseX GmbH, http://basex.org > > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
--
France Baril
Architecte documentaire / Documentation architect
france.baril at architextus.com
(514) 572-0341
FB
The issue was when users click the button without selecting an item. The function received an empty parameter and was in fact trying to delete the root, not a hidden file in our export folder.
For all the times I get mad at security, it saved me a huge headache this time.
Thanks for taking the time to respond!
France
Quoted text · Dirk Kirsten · 137 lines
On Thu, Feb 27, 2014 at 2:02 PM, Dirk Kirsten <dk at basex.org> wrote: > Hi France, > > as Jens correctly pointed out your file path "/.DocumentRevisions-V100" > looks rather suspicious and I guess you neither want to delete this file > nor you can without sudo rights. This is in the root folder and in > general you don't want to delete these files as it could corrupt your > system. Are you _really_ sure you want to delete these files? > > This also explains why you can delete .DS_Store files as these should be > deleteable with normal user privileges. Maybe there is a symlink within > your folder to this directory (I don't have OS X nor do I have any > knowledge about it, so I actually have no idea). I very much doubt that > an update to BaseX 7.8 (or now to 7.8.1) did make any difference as this > is file system related. If you upgraded your OS, this could in fact make > a difference (once again: I guess, as this is OS X specific). > > Please take a look at the file permissions and check if the user has the > required permissions to delete this file. > > Cheers, > Dirk > > On 27/02/14 19:49, France Baril wrote: > > Hi, > > > > I can delete the .DS_Store hidden file, but apparently not the version > > file. > > > > The code has nothing special: > > > > *if* (*file:exists*(*$file-sys-destination*)) > > *then **file:delete*(*$file-sys-destination*, *true*()) > > *else *() > > > > > > where $file-sys-destination is a path to a folder in the form > > publication/model/os/carrier/lang. > > > > > > I upgraded to Maverick and to BaseX 7.8 at 2 days interval so I'm not > 100% > > sure which one is making a difference here. I'll run some more tests > once I > > get 7.8.1 running. I'm still on 7.8. > > > > > > > > > > On Thu, Feb 27, 2014 at 4:20 AM, Jens Erat <jens.erat at uni-konstanz.de > >wrote: > > > >> If you want to completely wipe a directory, I’d go for deleting and > >> recreating the directory itself anyway (given you can write to the > parent > >> folder). > >> > >> Yet I’m still curios about the path in the error message, are you really > >> trying to wipe the file system root or did you remove some part of the > path? > >> > >> -- > >> Jens Erat > >> > >> [phone]: tel:+49-151-56961126 > >> [mail]: mailto:email at jenserat.de > >> [jabber]: xmpp:jabber at jenserat.de > >> [web]: http://www.jenserat.de > >> > >> PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B > >> > >> > >> > >> Am 27.02.2014 um 10:14 schrieb Dirk Kirsten <dk at basex.org>: > >> > >>> Hello France, > >>> > >>> are you sure you have the required rights to deleted this file with the > >>> user executing BaseX? > >>> Id did a quick test and had not trouble deleted a hidden file. > >>> Furthermore, I did a quick look into the code and deleting works using > >>> the java.io.file.delete() function, so its seems not to be related to > >> BaseX. > >>> > >>> Cheers, > >>> Dirk > >>> > >>> On 27/02/14 02:46, France Baril wrote: > >>>> Hi, > >>>> > >>>> I need to be able to export content to a clean directory. When I > export > >>>> content to a directory that used to exist, I need to wipe and clean to > >>>> replace everything with new content. > >>>> > >>>> However, I am getting io-errors: Stopped at > >>>> > >>>> /Applications/basex/webapp/How2_StaticHTML.xqm, 738/30: > >>>> > >>>> [io-error] Path '/.DocumentRevisions-V100' cannot be deleted. > >>>> > >>>> Is there anyway from the basex side to allow deletion of hidden files > >> or do > >>>> I have to disable revisions on my computer, so these files never get > >>>> created in the first place? The second option seems rather drastic. > >>>> > >>>> > >>>> > >>>> > >>>> _______________________________________________ > >>>> BaseX-Talk mailing list > >>>> BaseX-Talk at mailman.uni-konstanz.de > >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >>>> > >>> > >>> -- > >>> Dirk Kirsten, BaseX GmbH, http://basex.org > >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > >>> _______________________________________________ > >>> BaseX-Talk mailing list > >>> BaseX-Talk at mailman.uni-konstanz.de > >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >> > >> > > > > > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
--
France Baril
Architecte documentaire / Documentation architect
france.baril at architextus.com
(514) 572-0341
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery