14_CUL_TCM97001: Use of uninitialized value $bitReverse in concatenation

Begonnen von vbs, 02 Januar 2019, 16:05:40

Vorheriges Thema - Nächstes Thema

vbs

Ich habe seit meinem MapleCUL häufig auch folgende Warning im Log (so 20mal pro Tag):

2019.01.02 03:18:03.788 1: PERL WARNING: Use of uninitialized value $bitReverse in concatenation (.) or string at ./FHEM/14_CUL_TCM97001.pm line 244.
2019.01.02 03:18:03.788 1: stacktrace:
2019.01.02 03:18:03.788 1:     main::__ANON__                      called by ./FHEM/14_CUL_TCM97001.pm (244)
2019.01.02 03:18:03.788 1:     main::checkCRCKW9010                called by ./FHEM/14_CUL_TCM97001.pm (1465)
2019.01.02 03:18:03.788 1:     main::CUL_TCM97001_Parse            called by fhem.pl (3806)
2019.01.02 03:18:03.788 1:     main::Dispatch                      called by ./FHEM/00_CUL.pm (948)
2019.01.02 03:18:03.788 1:     main::CUL_Parse                     called by ./FHEM/00_CUL.pm (832)
2019.01.02 03:18:03.788 1:     main::CUL_Read                      called by fhem.pl (3610)
2019.01.02 03:18:03.788 1:     main::CallFn                        called by ./FHEM/16_STACKABLE.pm (73)
2019.01.02 03:18:03.788 1:     main::STACKABLE_Parse               called by fhem.pl (3806)
2019.01.02 03:18:03.788 1:     main::Dispatch                      called by ./FHEM/00_CUL.pm (948)
2019.01.02 03:18:03.789 1:     main::CUL_Parse                     called by ./FHEM/00_CUL.pm (832)
2019.01.02 03:18:03.789 1:     main::CUL_Read                      called by fhem.pl (3610)
2019.01.02 03:18:03.789 1:     main::CallFn                        called by fhem.pl (727)


Listings meiner Devices hier zu finden (um Doppelungen zu vermeiden):
https://forum.fhem.de/index.php/topic,95216.0.html

vbs

Gibt's hier schon Neuigkeiten? Hab die Warnings ziemlich häufig.

vbs

Hier nochmal Logs von heute mit einer weiteren Warning. Meine Version ist ein paar Tage alt (hab gerade erste geupdatet):
2019.01.19 10:14:38.765 1 : PERL WARNING: Use of uninitialized value $bitReverse in concatenation (.) or string at ./FHEM/14_CUL_TCM97001.pm line 153.
2019.01.19 10:14:38.765 1 : stacktrace:
2019.01.19 10:14:38.766 1 : main::__ANON__ called by ./FHEM/14_CUL_TCM97001.pm (153)
2019.01.19 10:14:38.766 1 : main::checksum_W174 called by ./FHEM/14_CUL_TCM97001.pm (822)
2019.01.19 10:14:38.766 1 : main::CUL_TCM97001_Parse called by fhem.pl (3806)
2019.01.19 10:14:38.767 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 10:14:38.767 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 10:14:38.767 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 10:14:38.767 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 10:14:38.768 1 : main::CallFn called by ./FHEM/16_STACKABLE.pm (73)
2019.01.19 10:14:38.768 1 : main::STACKABLE_Parse called by fhem.pl (3806)
2019.01.19 10:14:38.768 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 10:14:38.768 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 10:14:38.768 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 10:14:38.768 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 10:14:38.769 1 : main::CallFn called by fhem.pl (727)

2019.01.19 10:14:38.769 1 : PERL WARNING: Use of uninitialized value $bitReverse in concatenation (.) or string at ./FHEM/14_CUL_TCM97001.pm line 176.
2019.01.19 10:14:38.769 1 : stacktrace:
2019.01.19 10:14:38.770 1 : main::__ANON__ called by ./FHEM/14_CUL_TCM97001.pm (176)
2019.01.19 10:14:38.770 1 : main::checkCRC called by ./FHEM/14_CUL_TCM97001.pm (901)
2019.01.19 10:14:38.770 1 : main::CUL_TCM97001_Parse called by fhem.pl (3806)
2019.01.19 10:14:38.770 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 10:14:38.770 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 10:14:38.771 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 10:14:38.771 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 10:14:38.771 1 : main::CallFn called by ./FHEM/16_STACKABLE.pm (73)
2019.01.19 10:14:38.771 1 : main::STACKABLE_Parse called by fhem.pl (3806)
2019.01.19 10:14:38.771 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 10:14:38.772 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 10:14:38.772 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 10:14:38.772 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 10:14:38.772 1 : main::CallFn called by fhem.pl (727)

vbs

Naja noch zwei  ;D (jetzt auf aktueller Version)
2019.01.19 14:22:37.883 1 : PERL WARNING: Use of uninitialized value $bitReverse in concatenation (.) or string at ./FHEM/14_CUL_TCM97001.pm line 965.
2019.01.19 14:22:37.883 1 : stacktrace:
2019.01.19 14:22:37.884 1 : main::__ANON__ called by ./FHEM/14_CUL_TCM97001.pm (965)
2019.01.19 14:22:37.884 1 : main::CUL_TCM97001_Parse called by fhem.pl (3877)
2019.01.19 14:22:37.884 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 14:22:37.884 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 14:22:37.884 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 14:22:37.884 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 14:22:37.884 1 : main::CallFn called by ./FHEM/16_STACKABLE.pm (73)
2019.01.19 14:22:37.884 1 : main::STACKABLE_Parse called by fhem.pl (3877)
2019.01.19 14:22:37.884 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 14:22:37.884 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 14:22:37.885 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 14:22:37.885 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 14:22:37.885 1 : main::CallFn called by fhem.pl (737)
2019.01.19 14:22:37.885 1 : PERL WARNING: Use of uninitialized value $bitUnreverse in concatenation (.) or string at ./FHEM/14_CUL_TCM97001.pm line 966.
2019.01.19 14:22:37.885 1 : stacktrace:
2019.01.19 14:22:37.885 1 : main::__ANON__ called by ./FHEM/14_CUL_TCM97001.pm (966)
2019.01.19 14:22:37.885 1 : main::CUL_TCM97001_Parse called by fhem.pl (3877)
2019.01.19 14:22:37.885 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 14:22:37.886 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 14:22:37.886 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 14:22:37.886 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 14:22:37.886 1 : main::CallFn called by ./FHEM/16_STACKABLE.pm (73)
2019.01.19 14:22:37.886 1 : main::STACKABLE_Parse called by fhem.pl (3877)
2019.01.19 14:22:37.886 1 : main::Dispatch called by ./FHEM/00_CUL.pm (948)
2019.01.19 14:22:37.886 1 : main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2019.01.19 14:22:37.886 1 : main::CUL_Read called by ./FHEM/98_apptime.pm (205)
2019.01.19 14:22:37.887 1 : main::apptime_getTiming called by ./FHEM/98_apptime.pm (165)
2019.01.19 14:22:37.887 1 : main::CallFn called by fhem.pl (737)

pejonp

Hallo vbs,

welche Version von 14_CUL_TCM97001.pm hast du.

ich habe diese Version

14_CUL_TCM97001.pm     18090 2018-12-30 07:24:59Z bjoernh


und das steht an dieser Zeilennummer ein define

...
963        my @a = split("", $msg);
.        my $bitReverse = undef;
.        my $bitUnreverse = undef;
.        my $x = undef;
.        my $bin3;
.        my $hlen = length($msg);
.        my $blen = $hlen * 4;
970        my $bitData = unpack("B$blen", pack("H$hlen", $msg));
....


Vielleicht noch einmal ein Update machen und FHEM durchstarten (fhem/linux).

pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

vbs

Ja, sorry nicht so schlau von mir, aber ich kann nicht mehr genau sagen, welche Version ich hatte. :/

Aber kann es recht leicht finden. Es geht in allen Fällen immer um diese Schleifen, in denen an eine undef-Variable ein String angehängt werden soll.

        my $bitReverse = undef;
        my $bitUnreverse = undef;
...
        foreach $x (@a) {
           $bitReverse = $bitReverse . substr(reverse($bin3),0,4);
           $bitUnreverse = $bitUnreverse . sprintf( "%b", hex( substr($bin3,0,4) ) );
        }



pejonp

@vbs
Mit Version bekommst du die Version raus.

Ich habe in der TCM... nachgesehen und an der zeilennummer diese stringvarable nicht gefunden, deshalb denke ich das die Datei defekt ist. Einfach nochmal ein Update oder ggg. Vorher die Datei versichern und löschen.

Pejonp


LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

vbs

Also ich hatte bis eben die Revision 16274, jetzt die aktuelle.

Ist mir ein Rätsel, dass der String bei dir nicht vorkommt. Ich denke meine Datei ist heil.

Such bitte nochmal nach "my $bitReverse = undef;". Das Muster, welches die Warning erzeugt, findet sich vielen Stellen im Code.

pejonp

Zitat von: vbs am 20 Januar 2019, 17:27:42
Also ich hatte bis eben die Revision 16274, jetzt die aktuelle.

Ist mir ein Rätsel, dass der String bei dir nicht vorkommt. Ich denke meine Datei ist heil.

Such bitte nochmal nach "my $bitReverse = undef;". Das Muster, welches die Warning erzeugt, findet sich vielen Stellen im Code.

Bei my "my $bitReverse = undef;". sollte eigentlich keine fehlermeldung kommen da richtig definiert.
Wie hast du verbose eingestellt ?

Pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

vbs

Nee nee, die Warning kommt nicht beim Anlegen der Variable... sondern später wenn versucht wird, einen String an undef anzuhängen. Daher die Meldung:
PERL WARNING: Use of uninitialized value $bitReverse in concatenation (.) or string at ./FHEM/14_CUL_TCM97001.pm line 176.

bjoernh

Aber du hast jetzt schon die letzte Version, oder?
Ich habs leider noch nicht gefunden. Habe die Meldung bei mir nicht  :(

vbs

Hm, ich glaube, wir haben hier irgendwie ein Missverständnis. Ich sag nochmal, was ich glaube:

Also im Code gibt es viele Stellen, an denen ein String zusammen gebaut wird. Die sehen immer ungefähr so aus:

  my $bitReverse = undef;
  ...
  foreach $x (@a) {
     my $bin3=sprintf("%04b",hex($x));
    $bitReverse = $bitReverse . reverse($bin3);
  }

Es geht um diese Zeile "    $bitReverse = $bitReverse . reverse($bin3); "

Es wird also versucht einen String (reverse($bin3)) an $bitReverse anzuhängen. Diese Variable ist jedoch mit "undef" initialisiert. Das erzeugt Warnings (vermtl. je nach Perl-Konfiguration).

Im Anhang mal ein Patch, bei dem ich ein paar Stellen gefixt habe, die bei mir aufgetreten sind. Aber ich denke, es gibt noch mehr.

EDIT:
Sorry, Patch vergessen...  :o

bjoernh

OK, glaube ich habs...

Ich teste das mal und checke es dann ein.

vbs

Hab nochmal zwei Stellen bei mir gefunden. Soll ich die posten oder hast du die jetzt schon händisch rausgeflöht?

bjoernh

Probiers mal nach dem Update aus. Ich habe es denke ich überall geändert.

vbs