Ticket #44061

fileseekback not working after update to 4.102

Open Date: 2022-03-09 21:57 Last Update: 2022-03-20 00:10

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
(None)
Priority:
6
Severity:
5 - Medium
Resolution:
Fixed
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

Hi,

I am using teraterm and macros for years now and with the latest update I did from 4.90 to 4.106, one of the macros stopped working. I could narrow it down to 4.102 being the version where my macro breaks. At one point I am creating a new file, setting a pointer just after creation, then writing a few chars to it and the get back to the pointer and read out that line.

  1. filecreate writehandle 'version.txt'
  2. filemarkptr writehandle
  3. filewrite writehandle 'SomeRandomText'
  4. filewrite writehandle str

Now the following bit of code stopped working with any version newer than 4.101

  1. fileseekback writehandle
  2. filereadln writehandle str
  3. fileclose writehandle
As a workaround, I have to close the file I just wrote to and reopen it for reading
  1. fileclose writehandle
  2. fileopen readhandle 'version.txt' 0
  3. filereadln readhandle str
  4. fileclose readhandle

Ticket History (3/7 Histories)

2022-03-09 21:57 Updated by: bugreporter2
  • New Ticket "fileseekback not working after update to 4.102" created
2022-03-11 00:36 Updated by: nmaya
Comment

Thank you for your reporting.

2022-03-11 00:45 Updated by: nmaya
Comment

発生時期(4.101-4.102の間)からすると、一番関係ありそうな変更は r7292

この変更により、filecreate して書き込むのに使ったファイルハンドルを読み込みに使い回せなくなっていますか?

投稿された再現用コードを整理

  1. filecreate writehandle 'version.txt'
  2. filemarkptr writehandle
  3. filewrite writehandle 'text'
  4. fileseekback writehandle
  5. filereadln writehandle str
  6. fileclose writehandle
  7. messagebox str param1

これも同じ問題が起きそうと思って書いてみたコード(再現しました)

  1. filecreate writehandle 'version.txt'
  2. filewrite writehandle 'text'
  3. fileseek writehandle 0 0
  4. filereadln writehandle str
  5. fileclose writehandle
  6. messagebox str param1
2022-03-13 00:44 Updated by: zmatsuo
Comment

CreateFile()の引数の問題だと思い、 filecreate マクロに関する修正をトレースしました。

  • r9134 CreateFileW(GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE)
-> CreateFileW(GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE)
  • r8778 replace _lcreat(0) with CreateFileW()
-> CreateFileW(GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE)
  • r8682 ttl.c -> ttl.cpp
  • r8437 create Tera Term 4 maintenance branch
  • r7452 Tera Term 4.102
  • r7292 convert to integer from file handle
  • r7290 replace win16 api with win32 api wrapper
_lcreat(0) -> win16_lcreat(0) in win16api.c -> CreateFileA(GENERIC_WRITE, FILE_SHARE_WRITE)
use _lcreat(0) (Windows API)

r7290 から問題があり、Tera Term 4 は 4.102以降(4-stable ブランチでは現在も)問題がある状態。

trunk は r9134 で修正されています。

4-stable branch を trunk と同様に修正してみます。

(Edited, 2022-03-13 01:49 Updated by: zmatsuo)
2022-03-13 02:15 Updated by: zmatsuo
Comment

I committed fixes(r9806)。

This is snapshot binary. Please test this.

https://osdn.net/projects/ttssh2/storage/snapshot/snapshot-teraterm4-r9806-20220313.zip

2022-03-18 23:14 Updated by: bugreporter2
Comment

Reply To zmatsuo

I committed fixes(r9806)。 This is snapshot binary. Please test this. https://osdn.net/projects/ttssh2/storage/snapshot/snapshot-teraterm4-r9806-20220313.zip

Hi,

sorry for the late reply I tested it with my old macro and it worked without problem!

Thank you

2022-03-20 00:10 Updated by: zmatsuo
  • Status Update from Open to Closed
  • Owner Update from (None) to zmatsuo
  • Resolution Update from None to Fixed
Comment

Thank you.

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login