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

module-ssh2: SftpPoller doesn't accept empty string as regex_mask #3377

Open
geckon opened this issue Apr 16, 2019 · 2 comments
Open

module-ssh2: SftpPoller doesn't accept empty string as regex_mask #3377

geckon opened this issue Apr 16, 2019 · 2 comments

Comments

@geckon
Copy link
Contributor

geckon commented Apr 16, 2019

(and fails not very transparently instead)

$ qore -n -l SftpPoller -e 'class MySftpPoller inherits SftpPoller {constructor(SFTPClient sftp, hash nconf): SftpPoller(sftp, nconf) {} postSingleFileEvent(hash fih) {} singleFileEvent(hash fih) {}} MySftpPoller a(new SFTPClient("sftp://localhost:22"), {"regex_mask": ""});'
unhandled QORE System exception thrown in TID 1 at 2019-04-16 13:14:11.973498 Tue +02:00 (CEST) in SftpPoller::constructor() (/usr/share/qore-modules/SftpPoller.qm:316 (Qore user code))
INVALID-MEMBER: 'regex_mask' is not a registered member of class 'MySftpPoller'
call stack:
  2: SftpPoller::constructor() (<command-line>:1 (Qore user code))
  1: MySftpPoller::constructor() (<command-line>:1 (Qore user code))

This is because of how SftpPoller accepts arguments, specifically for regex_mask:

            if (conf.regex_mask) {
                mask = remove conf.regex_mask;
                re = True;
                conf -= "mask";
            }

            # set options
            self += conf;

-> if regex_mask evaluates to False in bool context, SftpPoller considers it not being in the conf hash and doesn't remove it (but it is there) and then it fails when it tries to assign the rest of the hash to its' member variables.

@sejvlond
Copy link
Contributor

bug for sure, but just wondering, what should the empty mask do?

@geckon
Copy link
Contributor Author

geckon commented Apr 16, 2019

Well, an empty string is a valid regex matching anything.

@davidnich davidnich added this to To do in Qore Development via automation Sep 25, 2020
@davidnich davidnich added this to the not planned milestone Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants