记录一个奇葩的问题。。。
今天在写shell的时候,调用curl调用python写的接口,一直报这样的问题。
*** Error in `sh': double free or corruption (out): 0x0000000001e9d740 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7f09673fe329]
sh(echo_builtin+0x16b)[0x46e01b]
sh[0x42f27b]
sh[0x4351dc]
sh[0x4309f4]
sh(execute_command_internal+0xa83)[0x4322e3]
sh[0x435441]
sh(execute_command_internal+0x1a4f)[0x4332af]
sh(execute_command_internal+0x10f3)[0x432953]
sh(execute_command+0x4e)[0x433cce]
sh(execute_command_internal+0x10b7)[0x432917]
sh(execute_command+0x4e)[0x433cce]
sh(execute_command_internal+0x10b7)[0x432917]
sh(execute_command_internal+0xfdf)[0x43283f]
sh[0x434e2f]
sh[0x4316f1]
sh(execute_command_internal+0xa83)[0x4322e3]
sh(parse_and_execute+0x334)[0x46f6e4]
sh[0x46ef43]
sh(source_file+0x3d)[0x46f1ad]
sh(source_builtin+0x12f)[0x47786f]
sh[0x42f27b]
sh[0x4313d9]
sh(execute_command_internal+0xa83)[0x4322e3]
sh(execute_command+0x4e)[0x433cce]
sh(reader_loop+0x195)[0x41e305]
sh(main+0xc4e)[0x41c96e]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f096739f555]
sh[0x41d40a]
======= Memory map: ========
00400000-004dd000 r-xp 00000000 fd:11 132640 /usr/bin/bash
006dd000-006de000 r--p 000dd000 fd:11 132640 /usr/bin/bash
006de000-006e7000 rw-p 000de000 fd:11 132640 /usr/bin/bash
006e7000-006ed000 rw-p 00000000 00:00 0
01e1d000-01ee1000 rw-p 00000000 00:00 0 [heap]
7f0960000000-7f0960021000 rw-p 00000000 00:00 0
7f0960021000-7f0964000000 ---p 00000000 00:00 0
7f0966f54000-7f0966f69000 r-xp 00000000 fd:11 528991 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f0966f69000-7f0967168000 ---p 00015000 fd:11 528991 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f0967168000-7f0967169000 r--p 00014000 fd:11 528991 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f0967169000-7f096716a000 rw-p 00015000 fd:11 528991 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f096716a000-7f0967176000 r-xp 00000000 fd:11 529051 /usr/lib64/libnss_files-2.17.so
7f0967176000-7f0967375000 ---p 0000c000 fd:11 529051 /usr/lib64/libnss_files-2.17.so
7f0967375000-7f0967376000 r--p 0000b000 fd:11 529051 /usr/lib64/libnss_files-2.17.so
7f0967376000-7f0967377000 rw-p 0000c000 fd:11 529051 /usr/lib64/libnss_files-2.17.so
7f0967377000-7f096737d000 rw-p 00000000 00:00 0
7f096737d000-7f0967541000 r-xp 00000000 fd:11 528971 /usr/lib64/libc-2.17.so
7f0967541000-7f0967740000 ---p 001c4000 fd:11 528971 /usr/lib64/libc-2.17.so
7f0967740000-7f0967744000 r--p 001c3000 fd:11 528971 /usr/lib64/libc-2.17.so
7f0967744000-7f0967746000 rw-p 001c7000 fd:11 528971 /usr/lib64/libc-2.17.so
7f0967746000-7f096774b000 rw-p 00000000 00:00 0
7f096774b000-7f096774d000 r-xp 00000000 fd:11 528987 /usr/lib64/libdl-2.17.so
7f096774d000-7f096794d000 ---p 00002000 fd:11 528987 /usr/lib64/libdl-2.17.so
7f096794d000-7f096794e000 r--p 00002000 fd:11 528987 /usr/lib64/libdl-2.17.so
7f096794e000-7f096794f000 rw-p 00003000 fd:11 528987 /usr/lib64/libdl-2.17.so
7f096794f000-7f0967974000 r-xp 00000000 fd:11 134573 /usr/lib64/libtinfo.so.5.9
7f0967974000-7f0967b74000 ---p 00025000 fd:11 134573 /usr/lib64/libtinfo.so.5.9
7f0967b74000-7f0967b78000 r--p 00025000 fd:11 134573 /usr/lib64/libtinfo.so.5.9
7f0967b78000-7f0967b79000 rw-p 00029000 fd:11 134573 /usr/lib64/libtinfo.so.5.9
7f0967b79000-7f0967b9b000 r-xp 00000000 fd:11 528958 /usr/lib64/ld-2.17.so
7f0967d92000-7f0967d95000 rw-p 00000000 00:00 0
7f0967d97000-7f0967d98000 rw-p 00000000 00:00 0
7f0967d98000-7f0967d9a000 rw-p 00000000 00:00 0
7f0967d9a000-7f0967d9b000 r--p 00021000 fd:11 528958 /usr/lib64/ld-2.17.so
7f0967d9b000-7f0967d9c000 rw-p 00022000 fd:11 528958 /usr/lib64/ld-2.17.so
7f0967d9c000-7f0967d9d000 rw-p 00000000 00:00 0
7ffe8fcf7000-7ffe8fd18000 rw-p 00000000 00:00 0 [stack]
7ffe8fdbe000-7ffe8fdc1000 r--p 00000000 00:00 0 [vvar]
7ffe8fdc1000-7ffe8fdc2000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
经过长时间定位,确定接口调用没有问题,接口返回的json中,UTF-8的中文用用\code了,如下:
{"status": "success", "error": "", "error_code": "", "data": "\u83b7\u53d6\u6570\u636e\u5e93\u6d41\u6c34\u7ebfpod\u65e5\u5fd7_202202242106423618"}
而后面shell处理的时候:
RESULT=`curl balabala`
echo -en "${RESULT}" |grep "sucess"
就出现了这样的报错。
解决方法:
echo -en
-->
echo -n # 不要用-e在选项