close
Comments you submit will be routed for moderation. If you have an account, please log in first.
Modify

Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#536 closed bug (fixed)

Arexx function MAILCHECK does not work correctly

Reported by: opiopi Owned by: tboeckel
Priority: normal Milestone: YAM 2.9p1
Component: ARexx interface Version: 2.6p1
Severity: major Keywords:
Cc: OS Platform: All
Blocked By: Blocking:
Release Notes:

fixed a minor bug in the MAILCHECK Arexx command where the STEM variables weren't correctly initialized.

Description

The Arexx function MAILCHECK does not work correctly.
I add 3 lines (ADDRESS 'YAM' and the tast 2 lines) to the example script in the documentation and attach the script here.
If i execute the attached script i get the follow output:
12.Ram_Disk:> rx GetMailExample.rexx
Downloaded emails: ST.DOWNLOADED
Left on server: ST.ONSERVER
Duplicates skipped: ST.DUPSKIPPED
Deleted on server: ST.DELETED
RC: 5
Result RESULT
12.Ram_Disk:>

YAM should display the correct values instead of the names in big letters.
The RC variable is set to 5 if no Mails are loaded and 20 if at least one mail is loaded.
The doc say that RC is set to 5 if the TCP/IP stack is not online, but the TCP/IP stack is online here.
The doc say nothing about the RESULT variable in the V2.0 version.

Attachments (7)

GetMailExample.rexx (363 bytes) - added by opiopi 7 months ago.
GetMails.rexx (666 bytes) - added by opiopi 7 months ago.
PIC-YAM-001.png (6.7 KB) - added by opiopi 7 months ago.
PIC-YAM-002.png (10.1 KB) - added by opiopi 7 months ago.
result_thore.png (22.8 KB) - added by tboeckel 7 months ago.
Partly successful result for 2 out of 3 accounts
GetMailsWait.rexx (830 bytes) - added by opiopi 7 months ago.
PIC-YAM-003.png (4.2 KB) - added by opiopi 7 months ago.

Download all attachments as: .zip

Change History (26)

comment:1 Changed 45 years ago by opiopi

  • Status changed from pending to new

Changed 7 months ago by opiopi

comment:1 Changed 7 months ago by tboeckel

  • Milestone set to YAM 2.9p1
  • Owner set to tboeckel
  • Priority changed from undecided to normal
  • Status changed from new to assigned

comment:2 Changed 7 months ago by tboeckel

  • Version changed from nightly build to 2.6p1

comment:3 Changed 7 months ago by tboeckel

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7754:

  • rexx/mailcheck.c: added the missing initialization of the result stem variable. This closes #536.

comment:4 Changed 7 months ago by opiopi

  • Resolution fixed deleted
  • Status changed from closed to reopened

Sorry for reopening but MAILCHECK still work not correct.
I run attached script GetMails.rexx and got 14 E-Mails at the first account.
But the requester show me that i got 14 E-Mails on every account. (see PIC-YAM-001.png)
If i run the script a second time with no Mails downloaded i get a requester like in picture PIC-YAM-002.png.
Seems the stem variable get not initialized at the start.

And what about the RC Variable. As you can see in the pictures i get a RC=5 if no mails are loaded. The Doc say that RC=5 mean the stack is not online which is not true. So either the program or the doc should be changed.

Changed 7 months ago by opiopi

Changed 7 months ago by opiopi

Changed 7 months ago by opiopi

comment:5 Changed 7 months ago by tboeckel

The download results are definitely reset to zero ahead of getting mails from a specific server. The results are summed up if and only if no account number is given and all available accounts are checked.

For me at least the first and second account out of three were polled successfully. For the third I get the same effect as you with the download results of the last successful one, the second one in my case. Calling the script a second time gives exactly the same failure as for you.

The strange thing is that your script fails even if YAM is terminated and restarted from scratch. Hence I assume a bug in ARexx itself here rather than YAM. But this is nothing we can control.

Changed 7 months ago by tboeckel

Partly successful result for 2 out of 3 accounts

comment:6 Changed 7 months ago by opiopi

It seems that the STEM Variables is set (SetRexxVar()) only if RC=0 (see file Rexx.c Line 858 ) but we have rc=5 if no mail is on the server, so the next call of MAILCHECK with the next server seems to use the old values.
I don't check where the wrong rc value is set...

comment:7 Changed 7 months ago by stellan

I just want to mention that I also had some issues with MAILCHECK. At least with option MANUAL. I`ve to check first before I can provide facts but some wrong or missing RC/RESULTS or at least differ documentation to it. Maybe it was just a feature I missed.

comment:8 Changed 7 months ago by tboeckel

In 7758:

  • tcp/pop.c: don't treat no downloadable messages on the server as an error. This refs #536.

comment:9 Changed 7 months ago by tboeckel

With the latest change I can run the GetMail.rexx script several times without any problems, no matter if mails were downloaded or not. So please check again with the next nightly build.

Last edited 7 months ago by tboeckel (previous) (diff)

comment:10 Changed 7 months ago by tboeckel

  • OS Platform changed from AmigaOS3 to All
  • Status changed from reopened to pending

Any news?

comment:11 follow-up: Changed 7 months ago by opiopi

It is still not correct. If the connection go offline while the script is running you get still wrong values. Try attached script GetMailsWait.rexx and follow the instruction in the requester. You get the values for the first pop server for all follow popservers which is wrong. Here the values should be uninitialized (the variable name itself in big letters) or the values should be 0.

Changed 7 months ago by opiopi

Changed 7 months ago by opiopi

comment:12 in reply to: ↑ 11 Changed 7 months ago by tboeckel

Replying to opiopi:

It is still not correct. If the connection go offline while the script is running you get still wrong values. Try attached script GetMailsWait.rexx and follow the instruction in the requester. You get the values for the first pop server for all follow popservers which is wrong. Here the values should be uninitialized (the variable name itself in big letters) or the values should be 0.

But the RC value already indicates that something was not ok. Hence I'd say you should use the STEM variable if and only if RC==0. For any other value you must not use the variables.

comment:13 Changed 7 months ago by damato

  • Resolution set to fixed
  • Status changed from new to closed

I agree with Thore here. Good programming style would be to first check the RC value and only if it is 0 read out the other values, otherwise they are in an uninitialized state. In fact, this should be the usual programming style when programming ARexx.

comment:14 Changed 7 months ago by opiopi

The fact that the RC value must be checked first should be mentioned in the documentation and the example script should be changed too.

comment:15 Changed 7 months ago by tboeckel

I just added this paragraph to the general ARexx documentation:

IMPORTANT NOTE: Always check the RC return code after the command execution before examining any further returned variables. Additional variables will only be set for successfully executed commands with RC==0. A failed command execution will leave these variables unchanged in their previous state.

There is no point in repeating this for each and every single command.

Last edited 7 months ago by tboeckel (previous) (diff)

comment:16 Changed 7 months ago by opiopi

OK, now it's fine. :-)
I changed the MAILCHECK example script because the syntax was wrong. Now it should run as expected...

comment:17 Changed 7 months ago by damato

Ok, thanks. And of course, feel free to tune all the other Arexx API documentation examples as you like. We are really short on people taking care of the various documentation and I feel you would be the perfect person to actually taking care of the Arexx API documentation ;)

comment:18 Changed 7 months ago by damato

  • Release Notes modified (diff)

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.

This list contains all users that will be notified about changes made to this ticket.

These roles will be notified: Reporter, Owner, Subscriber

  • Frank Weber(Reporter, Participant)
  • Thore Böckelmann(Owner, Participant)