Opened 11 years ago

Closed 11 years ago

#4600 closed defect (fixed)

Journal: copy to Documents crashes Sugar

Reported by: manuq Owned by:
Priority: Urgent Milestone: Unspecified
Component: Sugar Version: Git as of bugdate
Severity: Critical Keywords:
Cc: godiard Distribution/OS: Unspecified
Bug Status: Unconfirmed


  • create a screenshot with Alt-1
  • go to Journal
  • open the palette of the screenshot item
  • select Copy To -> Documents


Change History (5)

comment:1 Changed 11 years ago by tch

I have isolated this problem to

"SugarExt.fat_set_hidden_attrib" call

I see two options:

  1. I check if path_file is in Documents folder, so I don't call this function.
  2. I modify this function to make sure the file belongs a fat fs.

Any suggestions?

comment:2 Changed 11 years ago by godiard

+1 to option a

comment:3 Changed 11 years ago by tch

Ok, going deeper, found that the crash is caused by something at

"fprintf(stdout, "Error %s attributes: %s\n", verb, strerror(errno));"

errno returns 25, but strerror(25) returns garbage string...

While I was reading about this, saw that strerror is not thread-safe, and switched to strerror_r. This stops sugar from crashing, but does not solve the garbage string issue.

comment:4 Changed 11 years ago by tch

Dsd gave a brief talk about including string.h when using strerror, which solves this issues. Just sent a pull-request.

comment:5 Changed 11 years ago by Martin Abente Lahaye

  • Resolution set to fixed
  • Status changed from new to closed

Include string.h to sugar-fatattr

According to dsd's wisdom, without being
included, strerror is undeclared.

Fixes #4600 sugar crashing when copying
journal entries to documents folder.

Signed-off-by: Martin Abente Lahaye <tch@…>

Changeset: ba8c435e5091c601820d6d08e7def119b0c8d3c3

Note: See TracTickets for help on using tickets.