Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line option -load doesn't work #31

Open
GoogleCodeExporter opened this issue Sep 14, 2015 · 5 comments
Open

Command line option -load doesn't work #31

GoogleCodeExporter opened this issue Sep 14, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a Windows shortcut to launch a session using the -load option
2. Double-click the shortcut

What is the expected output? What do you see instead?

Expect that Futty will launch the name profile, as putty does. Instead, it just 
shows the session list.


What version of the product are you using? On what operating system?

git build c3a279f, Jun 22 2012 08:55:30
Windows 7 Pro SP1


Please provide any additional information below.

I have a handful of shortcuts that have always worked well with putty. I then 
changed those to use futty instead and left the command line the same, and it 
does not launch the session, it shows the session list instead as though the 
-load option was not specified.

Original issue reported on code.google.com by rossmeta...@gmail.com on 26 Oct 2012 at 2:19

@GoogleCodeExporter
Copy link
Author

i got the same problem with the curent futty ver. please fix this....

Original comment by stefan.j...@googlemail.com on 8 Dec 2012 at 3:55

@GoogleCodeExporter
Copy link
Author

tldr; The workaround is to use file storage for sessions that you want to
launch with "-load"

This bug was introduced by the file storage patch.

Details:

I was investigating Issue 30, and I happened across this defect.  Note that
this will affect sessions loaded with the "-load <session_name>" parameter as
well as the "@<session_name>" param which would be supplied by jumplist
invocation.

In the original code, we'd call do_defaults(settings.c) with the session name.
If the result was not "launchable" i.e. there was no session by that name,
then we proceed to show the main config UI.

Roughly:

   if registry session exists
      start session
   else
      show config 
   end

In the patched version, at this operation in window.c, the author just
supplements this to additionally check for a file session if a registry
session was not found (do_defaults_file).

   if registry session exists
      start session
   else
      if file session exists
         start session
      else 
         show config 
      end
   end


That seems sensible.  Default to registry sessions, then check files.
However, a few calls later into the "if registry session exists" part, we run
into a problem.

The original implementation of open_settings_r, went directly into registry
queires.  The patched version now uses that function as a wrapper to
conditionally choose either the registry or file storage.

    windows/winstore.c:
    void *open_settings_r(const char *sessionname)
    {
            if (storagetype == 1) {
                    return file_open_settings_r(sessionname);
            } else {
                    return reg_open_settings_r(sessionname);
            }
    }

The variable storagetype defaults to "file"

  windows/winstore.c:

  // PUTTY Tray / PuTTY File - global storage type
  static int storagetype = 1;     // 0 = registry, 1 = file


So although the selection algorithm is to check for registry first, it is
impossible to actually check the registry becuase we'll follow always follow the
file path unless we set storagetype.


If we inspect the implementation of the later file backed session test,
do_defaults_file,  we see that it calls load_settings_file(as opposed to
load_settings).

    /*
     * HACK: PuttyTray / PuTTY File
     * Quick hack to load defaults from file
     */
    void load_settings_file(char *section, Conf * cfg)
    {
        void *sesskey;
            set_storagetype(1);
        sesskey = open_settings_r(section);

So load_settings_file explicitly sets storagetype to file before it makes the
call to the modified open_settings_r which branches on that value.

It ends up being the case that both do_defaults, and do_defaults_file have
the same result becuase of the default value of storagetype.


I should probably study further to understand where else defaulting to
storagetype==1 is valuable, but I think this whole problem can be avoided if
the default for storage type were 0.

Original comment by ajith.an...@gmail.com on 10 Aug 2013 at 6:34

@GoogleCodeExporter
Copy link
Author

BTW, there's -load and -loadfile command lines.. Also, it defaults to registry 
entries now. So this shouldn't be a problem anymore.  Please re-test against 
the current FuTTY/PuTTYTray builds and if it's still a problem report it to 
PuTTY Tray at https://github.com/FauxFaux/PuTTYTray/issues

Original comment by FireEgl on 31 Aug 2013 at 7:44

  • Changed state: Unverified
  • Added labels: Priority-Low
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

Issue 38 has been merged into this issue.

Original comment by FireEgl on 31 Aug 2013 at 8:02

@GoogleCodeExporter
Copy link
Author

Appears to be working as of FuTTY-2013-09-01.exe

Original comment by ajith.an...@gmail.com on 10 Oct 2013 at 9:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant