Regex, nodeMCU like : crash

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
LAurent_B
Posts: 5
Joined: Sun Apr 03, 2016 3:15 pm

Regex, nodeMCU like : crash

Post by LAurent_B » Tue Sep 20, 2016 4:41 pm

Hello,

the following code crash the board but it works fine with unix micropython. Where is the trouble ?

[code]
import ure

txtmsg = """client connected from ('192.168.0.44', 33714)
GET /?rouge=255&vert=255&bleu=255&time=15 HTTP/1.1
Host: 192.168.0.102
User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://192.168.0.102/
Connection: keep-alive"""

print(txtmsg)

rouge = ure.search('rouge=(.+)&vert', txtmsg)
print('rouge type: ',type(rouge), rouge.group(1))

vert = ure.search('vert=(.+)&bleu', txtmsg)
print('vert type: ',type(vert), vert.group(1))

bleu = ure.search('bleu=(.+)&time', txtmsg)
print('bleu type: ',type(bleu), bleu.group(1))

time = ure.search('time=(.+)\ HTTP', txtmsg)
print('time type: ',type(time), time.group(1))

[/code]


The boar is a chinese nodeMCU :
[code]
>>> import port_diag
FlashROM:
Flash ID: 1640e0 (Vendor: e0 Device: 4016)
Flash bootloader data:
Byte @2: 00
Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
Firmware checksum:
size: 530228
md5: bc440e0ab9bf219b447b76721de745b3
True
[/code]

And micropython is
[code]
MicroPython v1.8.4-38-g34e0198-dirty on 2016-09-20; ESP module with ESP8266
[/code]

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Regex, nodeMCU like : crash

Post by pythoncoder » Thu Sep 22, 2016 5:07 pm

I think you've found a bug in the ESP8266 implementation. Your code works on the Pyboard but crashes my reference Adafruit Feather Huzzah here. So I suggest you raise an issue on Github. If you are unsure how to do this I can do it for you.
Peter Hinch
Index to my micropython libraries.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Regex, nodeMCU like : crash

Post by Roberthh » Thu Sep 22, 2016 6:29 pm

Same on WiPy.
MicroPython v1.8.4-42-g93c4a6a-dirty on 2016-09-21; WiPy with CC3200

LAurent_B
Posts: 5
Joined: Sun Apr 03, 2016 3:15 pm

Re: Regex, nodeMCU like : crash

Post by LAurent_B » Mon Sep 26, 2016 4:02 pm

Hello,

The issue is here :
https://github.com/micropython/micropython/issues/2451

Thanks for your help.

Post Reply