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

py_remote hostname length #205

Open
ll4strw opened this issue Jun 10, 2024 · 5 comments
Open

py_remote hostname length #205

ll4strw opened this issue Jun 10, 2024 · 5 comments
Labels

Comments

@ll4strw
Copy link

ll4strw commented Jun 10, 2024

Hello,
I am trying to execute a code remotely using py_remote(hostname, hints, code, recovery) and I happen to be working with hostnames which length might exceed 32 chars. When I launch py_remote I get

log_message: rstrcpy not enough space in destination buffer, source length:[33], destination length:[32]; 
resulting state of destination [x-yyyy-00xx77.xxyyy.leidenuniv.], 
truncated from source [x-yyyy-00xx77.xxyyy.leidenuniv.nl]

Is this done deliberately? Many thanks in advance.

@korydraughn
Copy link
Contributor

iRODS definitely supports hostnames longer than that. My guess is the implementation of py_remote needs a tweak, but we'll investigate to be sure.

@ll4strw
Copy link
Author

ll4strw commented Jun 11, 2024

Hi Kory, by glancing at the code, it looks like this plugin uses

parseHostAddrStr( char * hostAddr, rodsHostAddr_t * addr )

which in turn uses splitPathByKey( hostAddr, buffer, LONG_NAME_LEN, port, SHORT_STR_LEN, ':' ) to parse a hostname.

Is then the plugin expecting a colon in the hostname string? Apparently it is, because any of the following hostname strings just work as expected

  • x-yyyy-00xx77.xxyyy.leidenuniv.nl:
  • x-yyyy-00xx77.xxyyy.leidenuniv.nl:1247

I guess in this case splitPathByKey could be substituted by a different function? Thanks!

@korydraughn
Copy link
Contributor

Nice investigative work!

We'll get a fix in for the next release of the PREP.

@ll4strw
Copy link
Author

ll4strw commented Jun 12, 2024

@korydraughn Sorry for the confusion.. actually the fix here could be much simpler than I thought. There is actually nothing wrong with the functions mentioned above. I propose to change
https://github.com/irods/irods/blob/e4b4e8a7266360bb38ee97d7f2eda69249567dff/lib/core/include/irods/rodsDef.h#L51
SHORT_STR_LEN from 32 to maybe 64. This is because if a hostname string presents a colon, then the buffer allocated for it will be LONG_NAME_LEN=256, in all other cases (no colon in string) it will be limited to SHORT_STR_LEN=32..and that causes the error that I observe.
Clearly, an alternative fix would just be to amend this plugin docs to mandate a port number (hence a colon in the hostname) when calling py_remote.
Which one does the iRODS team prefer?
One question though remains. Has anyone tried before to parse a hostname which length is bigger than 32 without specifying a port? I see that parseHostAddrStr is used more times in the iRODS code.

I could submit a PR.

Cheers, L.

@korydraughn
Copy link
Contributor

Changing that value could break people's deployments and backwards compatibility, so we can't change it at this time.

Which one does the iRODS team prefer?

It's not clear which way to go at the moment. We need to confirm what the input requirements and expectations are for remote, py_remote, and parseHostAddrStr.

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

No branches or pull requests

2 participants