Skip to content

rtc.confのバックスラッシュの後にスペースがある場合、urlparam2mapで空白のパラメータがある場合に設定を無視する#271

Open
Nobu19800 wants to merge 6 commits intoOpenRTM:masterfrom
Nobu19800:bugs/propspace
Open

rtc.confのバックスラッシュの後にスペースがある場合、urlparam2mapで空白のパラメータがある場合に設定を無視する#271
Nobu19800 wants to merge 6 commits intoOpenRTM:masterfrom
Nobu19800:bugs/propspace

Conversation

@Nobu19800
Copy link
Copy Markdown

@Nobu19800 Nobu19800 commented Mar 7, 2022

Identify the Bug

rtc.confで改行する場合のバックスラッシュの後にスペースがある場合に以下のエラーが発生する。

  File "C:\Python37\lib\site-packages\OpenRTM_aist\Properties.py", line 390, in getProperty
    node = self._getNode(keys, 0, self)
  File "C:\Python37\lib\site-packages\OpenRTM_aist\Properties.py", line 1224, in _getNode
    next = curr.hasKey(keys[index])
IndexError: list index out of range
manager.components.preconnect: ConsoleIn0.out?port=ConsoleOut0.in& \ <-ここにスペースがある
                                                    dataflow_type=push&interface_type=corba_cdr

またurlparam2map関数でパラメータが空白の場合にも同様のエラーが発生する。

manager.components.preconnect: ConsoleIn0.out?port=ConsoleOut0.in& \ 
                                                    dataflow_type=push&interface_type=corba_cdr&<-&だけ記述してパラメータを空白にする。

Description of the Change

  • Propertiesでキーの先頭、末尾の空白文字を削除して空文字だったら設定や取得の処理を行わない。
  • urlparam2map関数で入力文字列が空白の場合、=の左辺が空白の場合はパラメータを設定しないようにした。
  • PropertiesでValueの文字列で\の後に空白がある場合に警告を表示するようにした

Verification

  • Did you succeed the build?
  • No warnings for the build?
  • Have you passed the unit tests?

n-ando
n-ando previously approved these changes Mar 14, 2022
@n-kawauchi n-kawauchi marked this pull request as ready for review April 1, 2026 06:47
@n-kawauchi
Copy link
Copy Markdown

@Nobu19800

  • Ubuntu24.04環境での確認
  • rtc.conf内のスペースあり・なしの様子は、vimの :set list 指定での改行コード$の位置で判断できる
  • urlparam2map関数でパラメータが空白の場合、ワーニングは出ませんでしたがこれは正常動作ですか?
    $ python3 ConsoleIn.py -f rtc2.conf
    
    • この時使用したrtc2.confの内容は下記
      manager.components.preconnect: ConsoleIn0.out?port=ConsoleOut0.in& \$ <-改行コードの前にスペースはない
                                                      dataflow_type=push&interface_type=corba_cdr&$ <-&だけ記述してパラメータを空白にしている
      
  • 以下は動作OKと判断したものです
  • バックスラッシュの後にスペースがある場合、ワーニングが出ることを確認
    $ python3 ConsoleIn.py -f rtc.conf
    Warning: Trailing whitespace after '\' prevents line continuation: manager.components.preconnect: ConsoleIn0.out?port=ConsoleOut0.in& \
    
    • この時使用したrtc.confの内容は下記
      manager.components.preconnect: ConsoleIn0.out?port=ConsoleOut0.in& \ $ <-改行コードの前にスペースがある
                                                      dataflow_type=push&interface_type=corba_cdr$
      
  • バックスラッシュの後にスペースがない場合、正常に起動することを確認
    $ python3 ConsoleIn.py -f rtc.conf.noSpace
    
    • この時使用したrtc.conf.noSpaceの内容は下記
      manager.components.preconnect: ConsoleIn0.out?port=ConsoleOut0.in& \$ <-改行コードの前にスペースはない
                                                      dataflow_type=push&interface_type=corba_cdr$
      

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants