Dovecot version: 2.1.13 OS: Centos 6.3 CPU: 64bit x86 There appear to be two related errors in the decode2text.sh file (which can be used for indexing/ searching attachments). - ?The layout of "$formats" has repeated values for pdf, ppt, etc, so you should only match the pattern once by adding -m1 - ?The layout of "$formats" has the file extension in the second "column", so the "start of line"(^) match doesn't work as is. Original problem line (from ./src/plugins/fts/decode2texh.sh): ? ?fmt=`echo "$formats" | grep -w "^$content_type" | cut -d ' ' -f 2` Here are two options that appear to solve the problem. ?The first option is probably preferred, since it matches exactly the extension to the second "column". 1) switch the order of commands (cut & grep) and add -m1. ?for example: ? ?fmt=`echo "$formats" | cut -d ' ' -f 2 | ?grep -w -m1 "^$content_type"` -OR- 2) add "m1" and remove "^". ?for example: ? ? fmt=`echo "$formats" | grep -w -m1 "$content_type" | cut -d ' ' -f 2`
On 29.1.2013, at 20.59, bhs692-dove at yahoo.com wrote:> Dovecot version: 2.1.13 > OS: Centos 6.3 > CPU: 64bit x86 > > There appear to be two related errors in the decode2text.sh file (which can be used for indexing/ searching attachments). > - The layout of "$formats" has repeated values for pdf, ppt, etc, so you should only match the pattern once by adding -m1 > - The layout of "$formats" has the file extension in the second "column", so the "start of line"(^) match doesn't work as is. > > > Original problem line (from ./src/plugins/fts/decode2texh.sh): > fmt=`echo "$formats" | grep -w "^$content_type" | cut -d ' ' -f 2`This finds the the extension text based on the content-type and does it correctly. You seem to think it wants to search for the extension text. Why? If there's a bug, it's not in the script.