Bug 1595343 Comment 1 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

ote that I run C-C TB (FULL DEBUG VERSION) with additional dump added
for local debugging. 

I added more info to the log to show the name of the URL, |mUrl|. :
they turned out to be files under temporary directory, |/tmp|.

I also added the directory listing of  |/tmp| directory of my linux PC:
mozmill creates temporary files there.
I dumped the listing to learn if the attachment files
not deleted have strange permission, etc.: No. It is owned by my
account and has read/write permission.

I also added the return value of |NS_GetFileFromURLSpec()| in the log.
I was curious if esoteric error was returned.: No, it was 
the generic 0x80004005 (NS_ERROR_FAILURE) .

Modification:
```
nsresult nsMsgAttachment::DeleteAttachment() {
  nsresult rv;
  bool isAFile = false;

  nsCOMPtr<nsIFile> urlFile;
  rv = NS_GetFileFromURLSpec(mUrl, getter_AddRefs(urlFile));
  NS_ASSERTION(NS_SUCCEEDED(rv), "Can't nsIFile from URL string");
#ifdef DEBUG
  if (!NS_SUCCEEDED(rv)) {
    int rc = 0;
#ifdef linux
    rc = system("ls -ltr /tmp/");
#endif
    fprintf(stderr,
            "{debug} DeleteAttachment: rv = 0x%" PRIx32 ", mUrl.data()==<<%s>>, rc=%d\n",
            static_cast<uint32_t>(rv), mUrl.Data(), rc);
  }
#endif
  if (NS_SUCCEEDED(rv)) {
    bool bExists = false;
    rv = urlFile->Exists(&bExists);
    NS_ASSERTION(NS_SUCCEEDED(rv), "Exists() call failed!");

    ... [omission]...
```
Note that I run C-C TB (FULL DEBUG VERSION) with additional dump added
for local debugging. 

I added more info to the log to show the name of the URL, |mUrl|. :
they turned out to be files under temporary directory, |/tmp|.

I also added the directory listing of  |/tmp| directory of my linux PC:
mozmill creates temporary files there.
I dumped the listing to learn if the attachment files
not deleted have strange permission, etc.: No. It is owned by my
account and has read/write permission.

I also added the return value of |NS_GetFileFromURLSpec()| in the log.
I was curious if esoteric error was returned.: No, it was 
the generic 0x80004005 (NS_ERROR_FAILURE) .

Modification:
```
nsresult nsMsgAttachment::DeleteAttachment() {
  nsresult rv;
  bool isAFile = false;

  nsCOMPtr<nsIFile> urlFile;
  rv = NS_GetFileFromURLSpec(mUrl, getter_AddRefs(urlFile));
  NS_ASSERTION(NS_SUCCEEDED(rv), "Can't nsIFile from URL string");
#ifdef DEBUG
  if (!NS_SUCCEEDED(rv)) {
    int rc = 0;
#ifdef linux
    rc = system("ls -ltr /tmp/");
#endif
    fprintf(stderr,
            "{debug} DeleteAttachment: rv = 0x%" PRIx32 ", mUrl.data()==<<%s>>, rc=%d\n",
            static_cast<uint32_t>(rv), mUrl.Data(), rc);
  }
#endif
  if (NS_SUCCEEDED(rv)) {
    bool bExists = false;
    rv = urlFile->Exists(&bExists);
    NS_ASSERTION(NS_SUCCEEDED(rv), "Exists() call failed!");

    ... [omission]...
```

Back to Bug 1595343 Comment 1