Jump to content











Photo
- - - - -

NOWARN option for FileDelete


  • Please log in to reply
21 replies to this topic

#1 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 10 March 2010 - 10:24 AM

I've discovered that there is no way to have FileDelete operations from not appearing as a warning in the log other than ShellExecute,Hide,cmd.exe,"/C del ...": http://www.boot-land...showtopic=10674.

FileDelete,FileToDelete,NOWARN produces a syntax error, my guess is that NOWARN is not yet an acceptable parameter for FileDelete. My suggestion is to add it as an optional parameter so that warning can be suppressed when desired. When supported, wand should give 'FileDelete,FileToDelete[,NOWARN]'.

Thanks,
Galapo.

#2 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 10 March 2010 - 10:33 AM

yes, thanks for the request...i totally support this...

#3 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 10 March 2010 - 07:51 PM

I've discovered that there is no way to have FileDelete operations from not appearing as a warning in the log other than ShellExecute,Hide,cmd.exe,"/C del ...": http://www.boot-land...showtopic=10674.

FileDelete,FileToDelete,NOWARN produces a syntax error, my guess is that NOWARN is not yet an acceptable parameter for FileDelete. My suggestion is to add it as an optional parameter so that warning can be suppressed when desired. When supported, wand should give 'FileDelete,FileToDelete[,NOWARN]'.

Thanks,
Galapo.

IMO the warning only appears when you checked "Debug Log". Here intentionally warning comes up on every delete.
Without the "Debug Log option" there should be no warning.

Maybe you have a special situation where a bug is active.

Then please post your script, and a log.

Peter

#4 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 10 March 2010 - 07:56 PM

Hi Peter,

Yes, this is in relation to the debug log. Currently there is not a way to suppress FileDelete operations from it other than using a workaround like the one posted above. Some FileDelete operations are totally unnecessary appearing there and I'd like the option of being able to have them not appear. Hence the suggestion here.

Regards,
Galapo.

#5 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 10 March 2010 - 08:06 PM

Hi Peter,

Yes, this is in relation to the debug log. Currently there is not a way to suppress FileDelete operations from it other than using a workaround like the one posted above. Some FileDelete operations are totally unnecessary appearing there and I'd like the option of being able to have them not appear. Hence the suggestion here.

Regards,
Galapo.


The intention is that "Debug Log" inactivates all "NOWARN".

Only in this way all "Overwrites", "Delete" "FileCreateBlank on existing files" etc. can be seen. And all of these informations are necessary to find a bug in a project. (When it does not run any more after including a certain script).

"Debug log" should be unchecked in default delivery. So for standard users nothing exciting happens.

Peter

#6 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 10 March 2010 - 08:41 PM

Hi Peter,

OK, can we then have an optional parameter NEVERWARN instead? Using NEVERWARN would mean that it wouldn't appear in the debug log.

I think a .script developer should be in control of what sometimes is redundant appearing in the debug log. Some FileDelete operations just don't need to appear there and it would be good to supress them.

Anyway, I've made my suggestion. pecd.net seconded. Up to you to decide whether you want to implement or not. We have workarounds such as that listed, but I always prefer internal functions if possible.

Thanks,
Galapo.

#7 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 06 April 2010 - 12:56 AM

Any news on this? Suggestion accepted or rejected?

Thanks,
Galapo.

#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 06 April 2010 - 08:02 AM

For whatever it may be useful, me thinks that the NEVERWARN opens the possibility to insert malicious code in a .script, besides making, if needed, debugging a problem, if anything happens that cannot be logged.

A possible solution, cannot say if actually doable, is to add a "level" to the debugging log settings.
I.e. now there is an ON/OFF switch:
  • Normal Log
  • Debug Log
maybe it would be possible to have a Debug Log (Verbose) that would allow to have EVERYTHING logged, whilst "simple" Debug Log could skip a number of warnings, including those with the NOWARN tag:
  • Normal Log
  • Debug Log
  • Verbose Debug Log

:whistling:
Wonko

#9 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 06 April 2010 - 08:10 AM

Any news on this? Suggestion accepted or rejected?

Thanks,
Galapo.

begin // FileDelete

		  if ForceWarning and not (flgNoWarn in CommandFlags) then

			icon := msgIcon_Warning

		  else

			icon := msgIcon_Success;
Peter

#10 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 06 April 2010 - 09:06 AM

  • Normal Log
  • Debug Log
  • Vaerbose Debug Log

Thanks, Wonko!

I added this.

But currently the only difference between standard and verbose debug log is the warning in FileDelete.

@All: Are there other commands where it makes sence to distinguish between standard and verbose?

Peter

#11 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 06 April 2010 - 09:30 AM

For whatever it may be useful, me thinks that the NEVERWARN opens the possibility to insert malicious code in a .script, besides making, if needed, debugging a problem, if anything happens that cannot be logged.

Hi Wonko,

My suggestion wasn't about removing logging, only that a way be made so that the command doesn't appear as a warning in the log when this is unnecessary. In other words, the FileDelete operation will still appear in the log, just not flagged as a warning when a particular flag is set.

begin // FileDelete

		  if ForceWarning and not (flgNoWarn in CommandFlags) then

			icon := msgIcon_Warning

		  else

			icon := msgIcon_Success;
Peter

Thanks Peter!

Regards,
Galapo.

#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 06 April 2010 - 09:39 AM

Hi Wonko,

My suggestion wasn't about removing logging, only that a way be made so that the command doesn't appear as a warning in the log when this is unnecessary. In other words, the FileDelete operation will still appear in the log, just not flagged as a warning when a particular flag is set.


Sure :blowup:, and my suggestion was different, in my perverted mind :blowup:, if a line is "normally" not useful, it should not be "normally" printed at all, but it should be printed when a "more detailed" view is asked.

Ideally, and again in my perverted mind :ph34r:, a log is useful the moment it shows what is needed (and not more or less) I personally like something that is "telescopic" or if you prefer has selectable "levels", the higher the level the less info is output, the lower the level more details are given.

:whistling:
Wonko

#13 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 06 April 2010 - 12:16 PM

To hijack this thread a bit.
Wouldn't it make more sense to have a switch in Winbuilder for tests, to allow / disallow overwrite of files / registry keys, then tidying up the log?

:whistling:

#14 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 06 April 2010 - 09:05 PM

To hijack this thread a bit.
Wouldn't it make more sense to have a switch in Winbuilder for tests, to allow / disallow overwrite of files / registry keys, then tidying up the log?

:whistling:

I'm not sure.

IMHO it is sufficient to have a standard log (w/o all the warnings etc) for the standard user who wants to have some hints why his project does not work.
And for developers there is the "Debug log" telling EVERYTHING including DeleteFile etc.

But I'm trying to fullfill all wishes and already coded
  • Galapo's "Do not show FileDelete"
  • Wonko's "Distinguish between 'standard' and 'verbose'"
I'm in doubt: Where is the sence?

Peter

#15 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 06 April 2010 - 09:43 PM

But I'm trying to fullfill all wishes and already coded

  • Galapo's "Do not show FileDelete"
  • Wonko's "Distinguish between 'standard' and 'verbose'"
I'm in doubt: Where is the sence?

Wonkos standard - verbose is nonsense imo, since it is the same as standard log - debug log.
Or were you talking about something else?

:whistling:

#16 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 06 April 2010 - 11:00 PM

Wouldn't it make more sense to have a switch in Winbuilder for tests, to allow / disallow overwrite of files / registry keys, then tidying up the log?

This thread was about FileDelete and it is a contradiction in terms to provide a flag to disallow the deletion.

For other operations like CopyOrExpand we already have the PRESERVE parameter that does what you suggest by disallowing the overwriting of files. For CAPI command require_file, files are already not overwritten by default and if this needs to be done then it needs to be specified with the OVERWRITE parameter.

To avoid registry overwrites, we already can use 'If,EXISTREGKEY' etc.

Regards,
Galapo.

#17 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 07 April 2010 - 11:28 AM

:dubbio:

Peter

#18 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 07 April 2010 - 11:51 AM

This thread was about FileDelete and it is a contradiction in terms to provide a flag to disallow the deletion.
To avoid registry overwrites, we already can use 'If,EXISTREGKEY' etc.

You've misunderstood my intentions.
I didn't meant a parameter to change the overwrite behaviour. I really meant a WB checkbox to change WB behaviour. This way one could easily run a quick test.
Changing the parameters for every command in all scripts takes way to long, to do it just for a test.

:dubbio:

#19 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 07 April 2010 - 03:49 PM

Wonkos standard - verbose is nonsense imo, since it is the same as standard log - debug log.


Wonko actually proposed a three level solution instead of the current two level one:

A possible solution, cannot say if actually doable, is to add a "level" to the debugging log settings.
I.e. now there is an ON/OFF switch:

  • Normal Log
  • Debug Log
maybe it would be possible to have a Debug Log (Verbose) that would allow to have EVERYTHING logged, whilst "simple" Debug Log could skip a number of warnings, including those with the NOWARN tag:
  • Normal Log
  • Debug Log
  • Verbose Debug Log


The more the levels you can choose in a (sometimes very looong) log (or text document) the easier it is to find the relevant info.

Obviously it's up to the Developers to choose how to "populate" the various levels.

Another idea - again cannot say if doable - could be to always create a RAW log with ALL the info psc finds useful for debug, and use a post-processor, with settings selectable by the .script developer and/or the user to parse just the relevant information and display it with a given "stylesheet".

Something like the stupid .XML format (stupid in the sense that is hardly human-readable without it's specific XML Schema or XSL stylesheet) and the even more stupid XSLT transformations (the ones you never find a good one when you need them and you only have RAW XML data :whistling:).

:dubbio:
Wonko

#20 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 12 November 2010 - 03:58 PM

sorry to drag up this old discussion but I have started seeing a lot of scripts using cmd.exe workarounds instead of the built in FileDelete command because of this issue, and I myself am having a hard time understanding why you would ever want a successful action to appear as a warning instead of a success in the log? shouldn't the warning be reserved for actions that don't complete successfully? otherwise what is the point? My understanding of the warning icon is to help make the log easier to read and find problems by pointing out failed attempts. by having successful operation displayed as warnings these failed attempts are lost in a sea of warnings for successful intended events and the log would be just as good off not having warnings at all! can anybody give me an example of why you would want a successful filedelete to show up as a warning icon and not a [success] icon?

#21 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 12 November 2010 - 07:49 PM

sorry to drag up this old discussion but I have started seeing a lot of scripts using cmd.exe workarounds instead of the built in FileDelete command because of this issue, and I myself am having a hard time understanding why you would ever want a successful action to appear as a warning instead of a success in the log? shouldn't the warning be reserved for actions that don't complete successfully? otherwise what is the point? My understanding of the warning icon is to help make the log easier to read and find problems by pointing out failed attempts. by having successful operation displayed as warnings these failed attempts are lost in a sea of warnings for successful intended events and the log would be just as good off not having warnings at all! can anybody give me an example of why you would want a successful filedelete to show up as a warning icon and not a [success] icon?

The mechanism is a part of the 'cooperative scripts' I introduced long time ago.
Shortly said:
- When you get this warning as .script developer during the test phase in a new script, you have to adjust some things.
- When you see this message as end user, the .script developer has done something wrong, and you should not use this script.

Q&D explanation:
-Script A needs file X and installs it.
-Script B deletes the file.
- >> Forum support question: "script A works fine, but when I install script B, script A does not work any more"
When you as .script developer are sure, that deletion of file X does not harm the final PE, use "FileDelete",...., NOWARN

Peter

#22 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 12 November 2010 - 09:07 PM

The mechanism is a part of the 'cooperative scripts' I introduced long time ago.
Shortly said:
- When you get this warning as .script developer during the test phase in a new script, you have to adjust some things.
- When you see this message as end user, the .script developer has done something wrong, and you should not use this script.

Q&D explanation:
-Script A needs file X and installs it.
-Script B deletes the file.
- >> Forum support question: "script A works fine, but when I install script B, script A does not work any more"
When you as .script developer are sure, that deletion of file X does not harm the final PE, use "FileDelete",...., NOWARN

Peter


thank you for the reply. I understand your reasoning's.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users