delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2016/01/14/18:21:07

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prochac.sk;
s=default; t=1452813601;
bh=NWyZekXgAkdv6lds//AedZ2VTKdooV661sIdJaqDVWE=;
h=Subject:To:References:From:Date:In-Reply-To;
b=U4OML88M64KlH8Y3SGYyvE0fhoGu25ID9G8dHjphmsecdY/l2nuvucV972nvkaPPS
EU3qwyhHJFckKmm/o4qsgjDRo/ueG3djDHQjlSaVEiqPunNXGuP3A6J8fRJQpfi1Ig
cdq9WzKm+wKXEkbWo5LTE7K+Z1klsvniEm31JLqs=
X-Clacks-Overhead: "GNU Terry Pratchett"
Subject: Re: [geda-user] pcb behavior when invoked on invlalid file needs to
change
To: geda-user AT delorie DOT com
References: <CAC4O8c9J6LaRRmNNcV2jJKYV5J430gcB_=wQ5dRMXxc+1xe5JQ AT mail DOT gmail DOT com>
From: "Milan Prochac (milan AT prochac DOT sk) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
Message-ID: <56982D6C.9040009@prochac.sk>
Date: Fri, 15 Jan 2016 00:21:16 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101
Thunderbird/38.5.0
MIME-Version: 1.0
In-Reply-To: <CAC4O8c9J6LaRRmNNcV2jJKYV5J430gcB_=wQ5dRMXxc+1xe5JQ@mail.gmail.com>
X-Spam-Status: No, score=-101.0 required=5.0 tests=ALL_TRUSTED,
USER_IN_WHITELIST autolearn=ham autolearn_force=no version=3.4.0
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on angua.bastl.sk
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 14. 1. 2016 21:28, Britton Kerin (britton DOT kerin AT gmail DOT com) [via 
geda-user AT delorie DOT com] wrote:
>
> If you do e.g.
>
>      pcb not_a_pcb_file.sch
>
> pcb will put a parse error message in the log for you (which you may 
> not even be viewing) and start editing a new blank pcb with the given 
> file name remembered.
>
> If you then do File->Save it will silently overwrite 
> not_a_pcb_file.sch with an empty pcb file.
>

It seems that it is by intention. There is comment in source files:
       /* keep filename even if initial load command failed;
        * file might not exist
        */

The reason of failure  is not provided/checked.

I guess that if file exists and load fails for file specified in command 
line, PCB should exit immediately.

The fix should be simple: check if file exists; if so, try to load it 
and exit with error status if it fails; if file does not exist, remember 
the fielname and continue with empty pcb. No more than 5 lines.  I will 
log the fix on LP later

> I got as far as fixing the file format plugin to replicate this 
> behavior before I stepped back and realized how insane it is.  
> Something must change.  Here are the options I can see:
>

How is the issue related to  format plugins?

Milan


>      1.  Make the parse error message much more noticeable (e.g. a 
> pop-up) and have it include a warning about the destructiveness of any 
> subsequent File->Save.  Easiest option.  Wouldn't risk messing up 
> batch mode pcb that depends on current behavior
>
>      2.  Make pcb do what it does after 
> File->Open(not_a_pcb_file.sch): don't remember the file name if the 
> file doesn't load right (then Save will do Save As).  Consistency with 
> File->Open is good.  Inconsistent with traditional unix command line 
> behavior where mentioned files get silently nuked is slightly bad, but 
> how many users really use deliberately use pcb to clobber non-pcb files?
>
>      3.  Both the above (without the destructiveness warning since 
> that wouldn't apply).
>
> I favor the third option.  A log message is not enough for this sort 
> of situation.  Option 2 seems ok but its still a great way to confuse 
> the user to show a blank file without explanation of why it isn't what 
> they wanted to edit, when you can easily help them out in this case.  
> However I've never used batch mode pcb so don't know for sure how this 
> might impact it.
>
> Informative opinions welcome.
>
> Britton
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019