Prevent an error mail from being sent to the original sender in the case of forwarding failure on Postfix

On Postfix, in the case of forwarding by aliases or .forward, if the forwarding results in an error, the error mail is sent to the original sender. The most easy way to prevent this behavior is setting the alias to a redirection to sendmail command and changing envelope sender address using sendmail -f option like below.

| /usr/sbin/sendmail -f <envelope sender address> <recipient address to forward>

Example:

/etc/aliases

foo: foo, "| /usr/sbin/sendmail -f bar xxx@example.com"

sendmail -f option sets the envelope sender address. This is the address where delivery problems are sent to ("bar" in the above example). This means that an error mail is not delivered to the original sender.

Be careful not to create infinite loop
In the above example, you should be careful that foo does not come to be the last recipient.

[postfix-jp:01469] Re: [Q] .forward で転送失敗のメールを送信者に知らせたくない

Find real type of typedef such as system data types

The easiest way is to use ptype with gdb.

Example:

foo.c

#include <sys/types.h>
struct st { int i; char c; };
typedef int Array[10];
typedef struct st St;
int main(void)
{ 
  size_t s1;
  ssize_t s2;
  pid_t pid;
  Array arr;
  St st1;
  return 0;
}
$ gcc -Wall -g -o foo foo.c
$ gdb foo
(gdb) b main
(gdb) run
(gdb) ptype s1
type = long unsigned int
(gdb) ptype size_t
type = long unsigned int
(gdb) ptype s2
type = long int
(gdb) ptype ssize_t 
type = long int
(gdb) ptype pid
type = int
(gdb) ptype pid_t
type = int
(gdb) ptype arr
type = int [10]
(gdb) ptype Array 
type = int [10]
(gdb) ptype st1
type = struct st {
    int i;
    char c;
}
(gdb) ptype St
type = struct st {
    int i;
    char c;
}

Like the above example,

ptype <expression or type name>

shows real type.

If the type is an array, it also shows its size. If the type is a struct, it also shows the type of the members of the struct. It's convenient.

You can probably find the real type using gcc -E option and looking into preprecessor's output like below, but it's bothersome and possibly needs hard work.

$ gcc -E foo.c | grep ssize_t
typedef long int __ssize_t;
typedef __ssize_t ssize_t;
(ommitted below)

In the above example (x86_64 GNU/Linux), you can find that ssize_t is
__ssize_t => long int

$ gcc -E foo.c | grep ssize_t
typedef long __darwin_ssize_t;
(ommitted)
typedef __darwin_ssize_t ssize_t;
(ommitted)

In the above example (Mac OS X), you can find that ssize_t is
ssize_t => __darwin_ssize_t => long